diff --git a/django_any/__init__.py b/django_any/__init__.py index 17b0c2d..71f6bb9 100644 --- a/django_any/__init__.py +++ b/django_any/__init__.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +__version__ = (0, 2, 1, 'dev', 0) from django_any.forms import any_form_field, any_form from django_any.models import any_field, any_model diff --git a/django_any/models.py b/django_any/models.py index f911a5f..fe30f92 100644 --- a/django_any/models.py +++ b/django_any/models.py @@ -25,8 +25,7 @@ validate_ipv46_address = None from django_any import xunit -from django_any.functions import valid_choices, split_model_kwargs, \ - ExtensionMethod +from django_any.functions import valid_choices, split_model_kwargs, ExtensionMethod any_field = ExtensionMethod() any_model = ExtensionMethod(by_instance=True) @@ -39,7 +38,7 @@ def any_field_blank(function): def wrapper(field, **kwargs): if kwargs.get('isnull', False): return None - + if field.blank and random.random < 0.1: return None return function(field, **kwargs) @@ -236,7 +235,7 @@ def get_some_file(path): result = get_some_file("%s/%s" % (path, subdir)) if result: return result - + if callable(field.upload_to): generated_filepath = field.upload_to(None, xunit.any_string(ascii_letters, 10, 20)) upload_to = os.path.dirname(generated_filepath) @@ -267,7 +266,7 @@ def get_some_file(path): if files: return random.choice(files) - + if field.recursive: for subdir in subdirs: result = get_some_file(subdir) diff --git a/docs/changelog.rst b/docs/changelog.rst index 581eae7..1a68314 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -7,7 +7,8 @@ Changelog ~~~~~ * Added xunit reference -* Updated setup.py and LICENCE +* Updated setup.py to use versiontools +* Minor updates and bugfixes in docs and LICENCE 0.2.0 ~~~~~ diff --git a/docs/conf.py b/docs/conf.py index adfb282..b74d399 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -16,7 +16,10 @@ # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.abspath('../django_any')) +sys.path.insert(0, os.path.abspath('..')) +os.environ['DJANGO_SETTINGS_MODULE'] = "tests.settings" +from versiontools import format_version +import django_any # -- General configuration ----------------------------------------------------- @@ -48,9 +51,9 @@ # built documents. # # The short X.Y version. -version = '0.2' +version = format_version(django_any.__version__, hint=django_any) # The full version, including alpha/beta/rc tags. -release = '0.2' +release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/xunit.rst b/docs/xunit.rst index cabf3fe..187f5cd 100644 --- a/docs/xunit.rst +++ b/docs/xunit.rst @@ -1,5 +1,5 @@ Xunit reference =============== -.. automodule:: xunit +.. automodule:: django_any.xunit :members: \ No newline at end of file diff --git a/setup.py b/setup.py index 8a14929..8152d52 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup( name='django-whatever', - version='0.2.1dev', + version = ":versiontools:your_package:", description='Unobtrusive test models creation for django.', long_description=read(path.join(path.dirname(__file__), 'README.rst')), author='Ilya Baryshev', @@ -16,6 +16,9 @@ include_package_data=True, test_suite = "tests.manage", zip_safe=False, + setup_requires = [ + 'versiontools >= 1.8', + ], license='MIT License', platforms = ['any'], classifiers=[