mirror of
https://github.com/Hopiu/django-fobi.git
synced 2026-05-10 22:03:09 +00:00
password pep8
This commit is contained in:
parent
315bf4f6f8
commit
1f4ae4d6cc
4 changed files with 47 additions and 31 deletions
|
|
@ -4,6 +4,7 @@ __copyright__ = '2014-2016 Artur Barseghyan'
|
|||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = ('default_app_config', 'UID',)
|
||||
|
||||
default_app_config = 'fobi.contrib.plugins.form_elements.fields.password.apps.Config'
|
||||
default_app_config = 'fobi.contrib.plugins.form_elements.fields.' \
|
||||
'password.apps.Config'
|
||||
|
||||
UID = 'password'
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ try:
|
|||
from django.apps import AppConfig
|
||||
|
||||
class Config(AppConfig):
|
||||
"""Config."""
|
||||
|
||||
name = 'fobi.contrib.plugins.form_elements.fields.password'
|
||||
label = 'fobi_contrib_plugins_form_elements_fields_password'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,3 @@
|
|||
__title__ = 'fobi.contrib.plugins.form_elements.fields.password.fobi_form_elements'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2016 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = ('PasswordInputPlugin',)
|
||||
|
||||
from django.forms.fields import CharField
|
||||
from django.forms.widgets import PasswordInput
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
|
@ -13,21 +7,26 @@ from fobi.base import FormFieldPlugin, form_element_plugin_registry, get_theme
|
|||
from . import UID
|
||||
from .forms import PasswordInputForm
|
||||
|
||||
__title__ = 'fobi.contrib.plugins.form_elements.fields.' \
|
||||
'password.fobi_form_elements'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2016 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = ('PasswordInputPlugin',)
|
||||
|
||||
theme = get_theme(request=None, as_instance=True)
|
||||
|
||||
|
||||
class PasswordInputPlugin(FormFieldPlugin):
|
||||
"""
|
||||
Password field plugin.
|
||||
"""
|
||||
"""Password field plugin."""
|
||||
|
||||
uid = UID
|
||||
name = _("Password")
|
||||
group = _("Fields")
|
||||
form = PasswordInputForm
|
||||
|
||||
def get_form_field_instances(self, request=None):
|
||||
"""
|
||||
Get form field instances.
|
||||
"""
|
||||
"""Get form field instances."""
|
||||
widget_attrs = {
|
||||
'class': theme.form_element_html_class,
|
||||
'placeholder': self.data.placeholder,
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
__title__ = 'fobi.contrib.plugins.form_elements.fields.password.forms'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2016 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = ('PasswordInputForm',)
|
||||
|
||||
from django import forms
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from fobi.base import BaseFormFieldPluginForm, get_theme
|
||||
from fobi.settings import DEFAULT_MAX_LENGTH
|
||||
|
||||
__title__ = 'fobi.contrib.plugins.form_elements.fields.password.forms'
|
||||
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
||||
__copyright__ = '2014-2016 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = ('PasswordInputForm',)
|
||||
|
||||
theme = get_theme(request=None, as_instance=True)
|
||||
|
||||
|
||||
class PasswordInputForm(forms.Form, BaseFormFieldPluginForm):
|
||||
"""
|
||||
Form for ``PasswordInputPlugin``.
|
||||
"""
|
||||
"""Form for ``PasswordInputPlugin``."""
|
||||
|
||||
plugin_data_fields = [
|
||||
("label", ""),
|
||||
("name", ""),
|
||||
|
|
@ -29,36 +29,50 @@ class PasswordInputForm(forms.Form, BaseFormFieldPluginForm):
|
|||
label = forms.CharField(
|
||||
label=_("Label"),
|
||||
required=True,
|
||||
widget=forms.widgets.TextInput(attrs={'class': theme.form_element_html_class})
|
||||
widget=forms.widgets.TextInput(
|
||||
attrs={'class': theme.form_element_html_class}
|
||||
)
|
||||
)
|
||||
name = forms.CharField(
|
||||
label=_("Name"),
|
||||
required=True,
|
||||
widget=forms.widgets.TextInput(attrs={'class': theme.form_element_html_class})
|
||||
widget=forms.widgets.TextInput(
|
||||
attrs={'class': theme.form_element_html_class}
|
||||
)
|
||||
)
|
||||
help_text = forms.CharField(
|
||||
label=_("Help text"),
|
||||
required=False,
|
||||
widget=forms.widgets.Textarea(attrs={'class': theme.form_element_html_class})
|
||||
widget=forms.widgets.Textarea(
|
||||
attrs={'class': theme.form_element_html_class}
|
||||
)
|
||||
)
|
||||
initial = forms.CharField(
|
||||
label=_("Initial"),
|
||||
required=False,
|
||||
widget=forms.widgets.TextInput(attrs={'class': theme.form_element_html_class})
|
||||
widget=forms.widgets.TextInput(
|
||||
attrs={'class': theme.form_element_html_class}
|
||||
)
|
||||
)
|
||||
max_length = forms.IntegerField(
|
||||
label=_("Max length"),
|
||||
required=True,
|
||||
widget=forms.widgets.TextInput(attrs={'class': theme.form_element_html_class}),
|
||||
initial = DEFAULT_MAX_LENGTH
|
||||
)
|
||||
widget=forms.widgets.TextInput(
|
||||
attrs={'class': theme.form_element_html_class}
|
||||
),
|
||||
initial=DEFAULT_MAX_LENGTH
|
||||
)
|
||||
required = forms.BooleanField(
|
||||
label=_("Required"),
|
||||
required=False,
|
||||
widget=forms.widgets.CheckboxInput(attrs={'class': theme.form_element_checkbox_html_class})
|
||||
widget=forms.widgets.CheckboxInput(
|
||||
attrs={'class': theme.form_element_checkbox_html_class}
|
||||
)
|
||||
)
|
||||
placeholder = forms.CharField(
|
||||
label=_("Placeholder"),
|
||||
required=False,
|
||||
widget=forms.widgets.TextInput(attrs={'class': theme.form_element_html_class})
|
||||
widget=forms.widgets.TextInput(
|
||||
attrs={'class': theme.form_element_html_class}
|
||||
)
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue