Skip to content
This repository has been archived by the owner on Sep 27, 2019. It is now read-only.

Commit

Permalink
rename and flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
okwrtdsh committed Jan 6, 2017
1 parent f7c01cc commit 7d9ea7a
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion django_cbv_utils/__init__.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion django_cbv_utils/forms/__init__.py
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions django_cbv_utils/forms/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
)


class SetFromControlMixin(forms.BaseForm):
class FormControlMixin(forms.BaseForm):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion django_cbv_utils/forms/widgets/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions django_cbv_utils/forms/widgets/numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -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={}):
Expand Down
12 changes: 5 additions & 7 deletions example/example/forms.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
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,
NumericIntegerWidget, NumericPositiveIntegerWidget, NumericWidget,
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"},
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [], {}
Expand Down

0 comments on commit 7d9ea7a

Please sign in to comment.