diff --git a/django_cbv_utils/__init__.py b/django_cbv_utils/__init__.py index d501174..9a76f05 100644 --- a/django_cbv_utils/__init__.py +++ b/django_cbv_utils/__init__.py @@ -1,4 +1,4 @@ -VERSION = (0, 1, 1) +VERSION = (0, 1, 2) # Dynamically calculate the version based on VERSION tuple if len(VERSION) > 2 and VERSION[2] is not None: diff --git a/django_cbv_utils/forms/__init__.py b/django_cbv_utils/forms/__init__.py index 8a92962..2f69679 100644 --- a/django_cbv_utils/forms/__init__.py +++ b/django_cbv_utils/forms/__init__.py @@ -1,7 +1,7 @@ from .choice import add_empty_choice from .clean import RequiredMixin from .layout import ( - SetDateTimePickerMixin, SetFromControlMixin, SetPositiveIntegerMixin, + DateTimePickerMixin, FormControlMixin, PositiveIntegerMixin, ) from .search import SearchForm from .widgets import * # NOQA diff --git a/django_cbv_utils/forms/layout.py b/django_cbv_utils/forms/layout.py index 0d085dd..269d881 100644 --- a/django_cbv_utils/forms/layout.py +++ b/django_cbv_utils/forms/layout.py @@ -6,7 +6,7 @@ ) -class SetFromControlMixin(forms.BaseForm): +class FormControlMixin(forms.BaseForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -17,7 +17,7 @@ def __init__(self, *args, **kwargs): {'class': "form-control"}) -class SetDateTimePickerMixin(forms.BaseForm): +class DateTimePickerMixin(forms.BaseForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -33,7 +33,7 @@ def __init__(self, *args, **kwargs): self.fields[field].widget = TimePickerWidget() -class SetPositiveIntegerMixin(forms.BaseForm): +class PositiveIntegerMixin(forms.BaseForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/django_cbv_utils/forms/widgets/misc.py b/django_cbv_utils/forms/widgets/misc.py index c747a54..1575e2a 100644 --- a/django_cbv_utils/forms/widgets/misc.py +++ b/django_cbv_utils/forms/widgets/misc.py @@ -5,5 +5,5 @@ def to_js_value(key, value): if isinstance(value, string_types): return "'%s'" % value if isinstance(value, bool): - return {True:'true',False:'false'}[value] + return {True: 'true', False: 'false'}[value] return value diff --git a/django_cbv_utils/forms/widgets/numeric.py b/django_cbv_utils/forms/widgets/numeric.py index 72961cb..85e4481 100644 --- a/django_cbv_utils/forms/widgets/numeric.py +++ b/django_cbv_utils/forms/widgets/numeric.py @@ -58,6 +58,7 @@ def __init__(self, attrs={}, options={}): options['decimal'] = options.get('decimal', False) super(NumericIntegerWidget, self).__init__(attrs, options) + class NumericPositiveIntegerWidget(NumericWidget): def __init__(self, attrs={}, options={}): diff --git a/example/example/forms.py b/example/example/forms.py index 6226566..c7a6d7b 100644 --- a/example/example/forms.py +++ b/example/example/forms.py @@ -1,11 +1,7 @@ -import datetime - from django import forms -from example.models import MyModel from django_cbv_utils.forms import ( - SearchForm, SetDateTimePickerMixin, SetFromControlMixin, - SetPositiveIntegerMixin, + DateTimePickerMixin, FormControlMixin, PositiveIntegerMixin, SearchForm, ) from django_cbv_utils.forms.widgets import ( BootstrapFileInputWidget, DatePickerWidget, DateTimePickerWidget, @@ -13,10 +9,12 @@ TimePickerWidget, ) +from example.models import MyModel + class MyModelSearchForm( - SearchForm, SetFromControlMixin, - SetDateTimePickerMixin, SetPositiveIntegerMixin): + SearchForm, FormControlMixin, + DateTimePickerMixin, PositiveIntegerMixin): queryset_filter = [ {"targets": "name", "op": "icontains_or", "fields": "name_icontains_or"}, diff --git a/setup.cfg b/setup.cfg index 66cb713..915b4c6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [flake8] max-line-length = 119 -exclude = example/**/migrations/*.py, example/example/settings.py, example/example/ci_settings.py +exclude = example/**/migrations/*.py, example/example/settings.py, example/example/ci_settings.py, __init__.py [isort] combine_as_imports = true diff --git a/setup.py b/setup.py index c72857f..2c0022d 100644 --- a/setup.py +++ b/setup.py @@ -20,6 +20,7 @@ def fullsplit(path, result=None): return result return fullsplit(head, [tail] + result) + # Compile the list of packages available, because distutils doesn't have # an easy way to do this. packages, package_data = [], {}