Exemple #1
0
class FormAdminForm(TendenciBaseForm):
    status_detail = forms.ChoiceField(choices=(
        ('draft', _('Draft')),
        ('published', _('Published')),
    ))

    intro = forms.CharField(required=False,
                            widget=TinyMCE(attrs={'style': 'width:100%'},
                                           mce_attrs={
                                               'storme_app_label':
                                               Form._meta.app_label,
                                               'storme_model':
                                               Form._meta.model_name.lower()
                                           }))

    response = forms.CharField(required=False,
                               label=_('Confirmation Text'),
                               widget=TinyMCE(
                                   attrs={'style': 'width:100%'},
                                   mce_attrs={
                                       'storme_app_label':
                                       Form._meta.app_label,
                                       'storme_model':
                                       Form._meta.model_name.lower()
                                   }))

    template = forms.ChoiceField(choices=template_choices, required=False)

    class Meta:
        model = Form
        fields = (
            'title',
            'slug',
            'intro',
            'response',
            'template',
            'send_email',  # removed per ed's request, added back per Aaron's request 2011-10-14
            'email_text',
            'subject_template',
            'completion_url',
            'email_from',
            'email_copies',
            'user_perms',
            'member_perms',
            'group_perms',
            'allow_anonymous_view',
            'status_detail',
            'custom_payment',
            'recurring_payment',
            'payment_methods',
            'intro_position',
            'fields_position',
            'pricing_position',
            'intro_name',
            'fields_name',
            'pricing_name',
        )

    def __init__(self, *args, **kwargs):
        super(FormAdminForm, self).__init__(*args, **kwargs)
        if self.instance.pk:
            self.fields['intro'].widget.mce_attrs[
                'app_instance_id'] = self.instance.pk
            self.fields['response'].widget.mce_attrs[
                'app_instance_id'] = self.instance.pk
            if self.instance.intro_name:
                self.fields['intro'].label = self.instance.intro_name
        else:
            self.fields['intro'].widget.mce_attrs['app_instance_id'] = 0
            self.fields['response'].widget.mce_attrs['app_instance_id'] = 0

        position_fields = [
            'intro_position', 'fields_position', 'pricing_position'
        ]
        for field in position_fields:
            self.fields[field].widget.attrs['class'] = 'position_field'

    def clean_slug(self):
        slug = slugify(self.cleaned_data['slug'])
        i = 0
        while True:
            if i > 0:
                if i > 1:
                    slug = slug.rsplit("-", 1)[0]
                slug = "%s-%s" % (slug, i)
            match = Form.objects.filter(slug=slug)
            if self.instance:
                match = match.exclude(pk=self.instance.pk)
            if not match:
                break
            i += 1
        return slug
Exemple #2
0
class TraiterSignalementForm(forms.Form):
    statut_specimen = forms.CharField(
        widget=forms.HiddenInput(), required=False)
    message = forms.CharField(
        widget=forms.Textarea, label="Message pour l'utilisateur:",
        max_length=1000, required=False)
Exemple #3
0
class RobokassaForm(BaseRobokassaForm):
    # login магазина в обменном пункте
    MrchLogin = forms.CharField(max_length=20, initial=LOGIN)

    # требуемая к получению сумма
    OutSum = forms.DecimalField(
        min_value=0, max_digits=20, decimal_places=2, required=False
    )

    # номер счета в магазине (должен быть уникальным для магазина)
    InvId = forms.IntegerField(min_value=0, required=False)

    # описание покупки
    Desc = forms.CharField(max_length=100, required=False)

    # контрольная сумма MD5
    SignatureValue = forms.CharField(max_length=32)

    # предлагаемая валюта платежа
    IncCurrLabel = forms.CharField(max_length=10, required=False)

    # e-mail пользователя
    Email = forms.CharField(max_length=100, required=False)

    # язык общения с клиентом (en или ru)
    Culture = forms.CharField(max_length=10, required=False)

    # Параметр с URL'ом, на который форма должны быть отправлена.
    # Может пригодиться для использования в шаблоне.
    target = FORM_TARGET

    def __init__(self, *args, **kwargs):

        super(RobokassaForm, self).__init__(*args, **kwargs)

        if TEST_MODE is True:
            self.fields["isTest"] = forms.BooleanField(required=False)
            self.fields["isTest"].initial = 1

        # скрытый виджет по умолчанию
        for field in self.fields:
            self.fields[field].widget = forms.HiddenInput()

        self.fields["SignatureValue"].initial = self._get_signature()

    def get_redirect_url(self):
        """ Получить URL с GET-параметрами, соответствующими значениям полей в
        форме. Редирект на адрес, возвращаемый этим методом, эквивалентен
        ручной отправке формы методом GET.
        """

        def _initial(name, field):
            val = self.initial.get(name, field.initial)
            return val

        fields = [
            (name, _initial(name, field))
            for name, field in list(self.fields.items())
            if _initial(name, field)
        ]
        params = urlencode(fields, encoding='1251')
        return self.target + "?" + params

    def _initial_val(self, name):
        value = (
            self.initial[name]
            if name in self.initial
            else self.fields[name].initial
        )
        if value is None:
            return ""
        return str(value)

    def _get_signature_string(self):
        _val = self._initial_val
        standard_part = ":".join(
            [_val("MrchLogin"), _val("OutSum"), _val("InvId"), PASSWORD1]
        )
        return self._append_extra_part(standard_part, _val)
Exemple #4
0
class LoginForm(forms.Form):
	email = forms.EmailField(widget = forms.EmailInput(attrs={'class':'validate'}))
	password = forms.CharField(max_length = 64, widget = forms.PasswordInput(attrs = {'class':'validate'}))
Exemple #5
0
class SearchForm(forms.Form):
	search = forms.CharField(max_length = 200, widget = \
		forms.TextInput(attrs = {'class':'validate','type':'search',\
			'id':'search','placeholder':'Search here'}))
Exemple #6
0
class LoginForm(forms.Form):
    username = forms.CharField(label='User Name',required=True,widget=forms.TextInput(attrs={'class':'form-control'}))
    password = forms.CharField(label='Password ',required=True,widget=forms.PasswordInput(attrs={'class':'form-control'}))
Exemple #7
0
class GraphForm(forms.ModelForm):
    json_input = forms.BooleanField(
        label=("JSON Input"),
        required=False,
        help_text=
        ("Check this box to define the graph with raw JSON instead of the graph editor."
         ))
    json_data = forms.CharField(
        label=("Graph JSON"),
        required=False,
        help_text=(
            "Copy-paste or type the JSON representation of your graph here."),
        widget=forms.Textarea(attrs={
            'cols': 80,
            'rows': 10
        }))

    def clean_json_data(self):
        """
        Validate JSON as being kmap structure
        """
        json_data = self.cleaned_data['json_data'].strip()
        if not json_data:
            raise forms.ValidationError("Error: graph cannot be blank")
        try:
            graph_list = json.loads(json_data)
            return graphCheck(graph_list)
        except ValueError:
            raise forms.ValidationError("Error: malformed JSON")
        except GraphIntegrityError as e:
            raise forms.ValidationError("Error: %(val)s", params={'val': e})

    class Meta:
        model = Graphs
        fields = [
            'name', 'description', 'public', 'study_active', 'json_input',
            'json_data', 'lti_key', 'lti_secret', 'secret'
        ]
        labels = {
            'name': ("Unit Name"),
            'study_active': ("Research study"),
            'lti_key': ("Consumer Key"),
            'lti_secret': ("Shared Secret"),
        }
        help_texts = {
            'public':
            ("Public units are displayed on the unit list. Private units will be accessible by anyone with the URL."
             ),
            'secret':
            ("The secret is used to modify the unit in the future. Please remember the value of this field!"
             ),
            'study_active':
            ("Check this only if you plan to use this unit as part of a research investigation."
             ),
        }
        widgets = {
            'name': forms.TextInput(attrs={'size': 40}),
            'description': forms.Textarea(attrs={
                'cols': 40,
                'rows': 2
            }),
            'secret': forms.HiddenInput(),
            'lti_key': forms.HiddenInput(),
            'lti_secret': forms.HiddenInput(),
        }
Exemple #8
0
class SearchForm(forms.Form):
    search = forms.CharField(max_length=100)
Exemple #9
0
class LoginForm(forms.Form):
    username = forms.CharField()
    password = forms.CharField()
class LoginForm(forms.Form):
    username = forms.CharField(max_length=255)
    password = forms.CharField(widget=forms.PasswordInput)
Exemple #11
0
class BaseWidget(forms.Form):

    template = 'xadmin/widgets/base.html'
    description = 'Base Widget, don\'t use it.'
    widget_title = None
    widget_icon = 'fa fa-plus-square'
    widget_type = 'base'
    base_title = None

    id = forms.IntegerField(label=_('Widget ID'), widget=forms.HiddenInput)
    title = forms.CharField(label=_('Widget Title'), required=False, widget=exwidgets.AdminTextInputWidget)

    def __init__(self, dashboard, data):
        self.dashboard = dashboard
        self.admin_site = dashboard.admin_site
        self.request = dashboard.request
        self.user = dashboard.request.user
        self.convert(data)
        super(BaseWidget, self).__init__(data)

        if not self.is_valid():
            raise WidgetDataError(self, self.errors.as_text())

        self.setup()

    def setup(self):
        helper = FormHelper()
        helper.form_tag = False
        helper.include_media = False
        self.helper = helper

        self.id = self.cleaned_data['id']
        self.title = self.cleaned_data['title'] or self.base_title

        if not (self.user.is_superuser or self.has_perm()):
            raise PermissionDenied

    @property
    def widget(self):
        context = {'widget_id': self.id, 'widget_title': self.title, 'widget_icon': self.widget_icon,
                   'widget_type': self.widget_type, 'form': self, 'widget': self}
        context.update(csrf(self.request))
        self.context(context)
        return loader.render_to_string(self.template, context)

    def context(self, context):
        pass

    def convert(self, data):
        pass

    def has_perm(self):
        return False

    def save(self):
        value = dict([(f.name, f.value()) for f in self])
        user_widget = UserWidget.objects.get(id=self.id)
        user_widget.set_value(value)
        user_widget.save()

    def static(self, path):
        return self.dashboard.static(path)

    def vendor(self, *tags):
        return self.dashboard.vendor(*tags)

    def media(self):
        return forms.Media()
Exemple #12
0
class AccountForm(forms.Form):
    username = forms.CharField(widget=forms.TextInput(
        attrs={'class': 'form-control'}))
    email = forms.EmailField(widget=forms.EmailInput(
        attrs={'class': 'form-control'}))
    password = forms.CharField(widget=forms.PasswordInput(
        attrs={'class': 'form-control'}))
    password_repeat = forms.CharField(widget=forms.PasswordInput(
        attrs={'class': 'form-control'}))
    first_name = forms.CharField(widget=forms.TextInput(
        attrs={'class': 'form-control'}))
    last_name = forms.CharField(widget=forms.TextInput(
        attrs={'class': 'form-control'}))
    tgl_lahir = forms.DateField(widget=forms.SelectDateWidget(years=YEARS))
    SEX_CHOICES = (
        ('Laki-laki', 'Laki-laki'),
        ('Perempuan', 'Perempuan'),
    )
    jenis_kelamin = forms.ChoiceField(choices=SEX_CHOICES)
    alamat = forms.CharField(widget=forms.Textarea)
    phone_number = forms.CharField(
        widget=forms.NumberInput(attrs={'class': 'form-control'}),
        required=False)
    id_instagram = forms.CharField(max_length=50)
    fb_url = forms.CharField(max_length=50)
    web_portofolio_url = forms.CharField(max_length=50)
    JOB_CHOICES = (('pljr/mhs', 'Pelajar/Mahasiswa'),
                   ('freelance', 'Freelance'), ('karyawan', 'Karyawan'),
                   ('blmbekerja', 'Belum Bekerja'), ('tgahli', 'Tenaga Ahli'),
                   ('wiraswasta', 'Wiraswasta'), ('lain', 'Lain-lain'))
    pekerjaan = forms.ChoiceField(choices=JOB_CHOICES)
    BIDANG_DESAIN = (
        ('branding', 'Branding'),
        ('illustration', 'Illustration'),
        ('publication', 'Publication'),
        ('webdesign', 'Web Design'),
        ('photography', 'Photography'),
        ('infographic', 'Infographic'),
        ('mograph', 'Motion Graphic'),
        ('dgimaging', 'Digital Imaging'),
        ('typography', 'Typography'),
        ('wpap', 'WPAP'),
        ('lettering', 'Lettering'),
        ('doodle', 'Doodle'),
        ('mural', 'Mural'),
        ('drawing', 'drawing'),
        ('fashiondesign', 'Fashion Design'),
        ('lain', 'Lain-lain'),
    )
    bidang_desain = forms.ChoiceField(choices=BIDANG_DESAIN)
    PROGRAM_DESAIN = (
        ('manual', 'Manual'),
        ('ps', 'Adobe Photoshop'),
        ('ai', 'Adobe Illustrator'),
        ('id', 'Adobe Indesign'),
        ('corel', 'CorelDraw'),
        ('autocad', 'Autocad'),
        ('paint', 'Paint'),
        ('mangastudio', 'Manga Studio'),
        ('quark', 'Quark Xpress'),
        ('3ds', '3D Max'),
        ('ink', 'Inkscape'),
        ('sketchup', 'Google SketchUp'),
        ('macromedia', 'Macromedia Freehand'),
        ('lain', 'Lain-lain'),
    )
    program_desain = forms.ChoiceField(choices=PROGRAM_DESAIN)
    deskripsi_diri = forms.CharField(widget=forms.Textarea)
    tujuan_gabung_bogrades = forms.CharField(widget=forms.Textarea)
    harapan_gabung_bogrades = forms.CharField(widget=forms.Textarea)
Exemple #13
0
class ToolIndexForm(forms.Form):
   name = forms.CharField(label="Tool Name", max_length=20, widget=forms.TextInput(attrs={'class' : 'form-control'}))
Exemple #14
0
class LoginForm(forms.Form):
    username = forms.CharField(max_length=15, widget=forms.TextInput(attrs={'placeholder': 'Username', 'class' : 'form-control'}))
    password = forms.CharField(label="Password", widget=forms.PasswordInput(attrs={'placeholder': 'Password', 'class' : 'form-control'}))
Exemple #15
0
class LoginForm(forms.Form):
    username = forms.CharField(widget=forms.TextInput(attrs={'class':'form-control',
                                    'placeholder':'Enter your password'}))
    password = forms.CharField(widget=forms.PasswordInput(attrs={'class':'form-control',
                                    'placeholder':'Enter your password'}))
Exemple #16
0
class ConceptActionForm(forms.Form):
    _selected_action = forms.CharField(widget=forms.MultipleHiddenInput)
    action = forms.CharField(widget=forms.HiddenInput())
    confirmed = forms.BooleanField(initial=False, widget=forms.HiddenInput())
Exemple #17
0
class WoodPasswordChangeForm(PasswordChangeForm):
    #template_name='registration/djangopassword_change_form.html'
    old_password = forms.CharField(label='Old Password',required=True,widget=forms.PasswordInput(attrs={'class':'form-control'}))
    new_password1 = forms.CharField(label='New Password', required= True, widget=forms.PasswordInput(attrs={'class' : 'form-control'}))
    new_password2 = forms.CharField(label='Confirm Password', required = True, widget=forms.PasswordInput(attrs={'class' : 'form-control'}))
Exemple #18
0
class SignupForm(forms.Form):
    username = forms.CharField(widget=forms.TextInput(attrs={
        'class': 'form-control',
    }))
    email = forms.EmailField(widget=forms.TextInput(attrs={
        'class': 'form-control',
    }),
                             required=False)
    password = forms.CharField(
        widget=forms.PasswordInput(attrs={
            'class': 'form-control',
        }), )
    password2 = forms.CharField(
        widget=forms.PasswordInput(attrs={
            'class': 'form-control',
        }), )
    introduce = forms.CharField(label='소개',
                                widget=forms.Textarea(attrs={
                                    'class': 'form-control',
                                }),
                                required=False)
    gender = forms.ChoiceField(
        widget=forms.Select(),
        choices=User.CHOICES_GENDER,
    )
    site = forms.URLField(label='사이트 url',
                          widget=forms.TextInput(attrs={
                              'class': 'form-control',
                          }),
                          required=False)
    img_profile = forms.ImageField()

    def clean_username(self):
        data = self.cleaned_data['username']
        if User.objects.filter(username=data).exists():
            raise ValidationError('유져ID 이미존재')
        return data

    def clean(self):
        super().clean()
        password = self.cleaned_data['password']
        password2 = self.cleaned_data['password2']

        if password != password2:
            self.add_error('password2', '비밀번호 불일치')
        return self.cleaned_data

    def signup(self):
        fields = [
            'username',
            'email',
            'password',
            'gender',
            'img_profile',
            'introduce',
            'site',
        ]
        create_user_dict = {}
        for key, value in self.cleaned_data.items():
            if key in fields:
                create_user_dict[key] = value
        #
        # create_user_dict = {key: value for key, value in self.cleaned_data.items() if key in fields}
        #
        # def in_fields(item):
        #     return item[0] in fields
        # result = filter(in_fields, self.cleaned_data.items())
        # create_user_dict={}
        # for item in result:
        #     create_user_dict[item[0]] = item[1]
        #
        # create_user_dict = dict(filter(in_fields, self.cleaned_data.items()))
        # create_user_dict = dict(filter(lambda item: item[0], self.cleaned_data.items()))
        print(create_user_dict)

        user = User.objects.create_user(**create_user_dict)
        return user
class ContactForm(forms.Form):
    Source = forms.CharField()
    Destination = forms.CharField()
    email = forms.EmailField()
Exemple #20
0
class FormCreateUser(forms.ModelForm):
    password2 = forms.CharField(
        label='Подтверждение нового пароля',
        widget=forms.TextInput(attrs={
            'type': 'password',
            'class': 'form-control',
            'autocomplete': 'off',
        }),
        help_text='Для подтверждения введите, пожалуйста, пароль ещё раз.',
        required=True,
    )

    class Meta:
        model = User
        fields = [
            'first_name',
            'last_name',
            'email',
            'username',
            'password',
        ]
        labels = {
            'username': '******',
        }
        widgets = {
            'first_name':
            forms.TextInput(
                attrs={
                    'class': 'form-control',
                    'placeholder': 'Введите имя пользователя',
                }),
            'last_name':
            forms.TextInput(
                attrs={
                    'class': 'form-control',
                    'placeholder': 'Введите фамилию пользователя',
                }),
            'username':
            forms.TextInput(
                attrs={
                    'class': 'form-control',
                    'placeholder': 'Введите логин пользователя',
                }),
            'email':
            forms.TextInput(
                attrs={
                    'type': 'email',
                    'class': 'form-control',
                    'placeholder': 'Введите электронный адрес',
                }),
            'password':
            forms.TextInput(
                attrs={
                    'type': 'password',
                    'class': 'form-control',
                    'autocomplete': 'off',
                }),
        }
        help_texts = {
            'username':
            '******',
            'password':
            '******'
            'Пароль должен содержать как минимум 8 символов.',
        }
Exemple #21
0
class RegsiterForm(forms.Form):
    username = forms.CharField(min_length=3,
                               max_length=16,
                               label="用户名",
                               help_text="",
                               error_messages={
                                   "min_length": "用户名最小长度为3",
                                   "max_length": "用户名最大长度为16",
                                   "required": "用户名不能为空",
                               },
                               widget=forms.widgets.TextInput(
                                   attrs={"class": "form-control"}, ))

    nickname = forms.CharField(min_length=3,
                               max_length=32,
                               label="用户昵称",
                               error_messages={
                                   "min_length": "用户名最小长度为3",
                                   "max_length": "用户名最大长度为32",
                               },
                               widget=forms.widgets.TextInput(
                                   attrs={"class": "form-control"}, ))

    password = forms.CharField(min_length=6,
                               label="密码",
                               error_messages={
                                   "min_length": "密码最小长度为6",
                                   "require": "密码不能为空"
                               },
                               widget=forms.widgets.PasswordInput(
                                   attrs={"class": "form-control"}, ))
    repassword = forms.CharField(min_length=6,
                                 label="确认密码",
                                 error_messages={
                                     "min_length": "密码最小长度为6",
                                     "require": "密码不能为空"
                                 },
                                 widget=forms.widgets.PasswordInput(
                                     attrs={"class": "form-control"}, ))

    email = forms.EmailField(
        label="邮箱",
        error_messages={"require": "邮箱不能为空"},
        widget=forms.widgets.EmailInput(attrs={"class": "form-control"}))

    phone = forms.CharField(
        label="电话号码",
        widget=forms.widgets.TextInput(attrs={"class": "form-control"}))

    # 重写username字段的局部钩子函数
    def clean_username(self):
        username = self.cleaned_data.get("username")
        is_exit = models.UserInfo.objects.filter(username=username).first()

        if is_exit:
            # 用户名以存在
            self.add_error("username", ValidationError("用户名已存在"))
        else:
            return username

    # 重写email字段的局部钩子函数
    def clean_email(self):
        email = self.cleaned_data.get("email")
        is_exit = models.UserInfo.objects.filter(email=email).first()

        if is_exit:
            # 邮箱已经被注册
            self.add_error("email", ValidationError("邮箱已经被注册"))
        return email

    # 重写phone字段的局部钩子函数
    def clean_phone(self):
        phone = self.cleaned_data.get("phone")
        #验证电话号码是否符合格式
        return phone

    # 重写全局的钩子函数
    def clean(self):

        # 校验两次输入的密码是否一致
        password = self.cleaned_data.get("password")
        repassword = self.cleaned_data.get("repassword")

        if repassword and repassword != password:
            self.add_error("repassword", ValidationError("两次输入的密码不一致"))
        else:
            return self.cleaned_data
Exemple #22
0
class PermissionChangeFormBase(forms.ModelForm):
    old_password = forms.CharField(
        label=_("Your Password"),
        widget=forms.PasswordInput,
        help_text=_(
            "In order to allow making significant changes to accounts, we need "
            "to confirm that you know the password for the account you are using."
        )
    )

    def __init__(self, changing_user, *args, **kwargs):
        super(PermissionChangeFormBase, self).__init__(*args, **kwargs)
        self.changing_user = changing_user
        if not getattr(self.changing_user, 'is_superuser', False):
            self.fields.pop("is_superuser")

        if not (
            self.changing_user == self.instance
            or getattr(self.instance, 'is_superuser', False)
        ):
            # Only require old password when editing
            self.fields.pop("old_password")

        if "is_superuser" in self.fields:
            self.fields["is_superuser"].label = _("Superuser (Full rights) status")
            self.fields["is_superuser"].help_text = _(
                "Designates whether this user has all permissions without explicitly "
                "assigning them. Assigning Granular Permission Groups to a Superuser "
                "will not have any effect because Granular Permission Groups are only "
                " able to give more rights, but Superuser already has them all."
            )
        self.fields["is_staff"].label = _("Access to Admin Panel status")
        self.fields["is_staff"].help_text = _(
            "Designates whether this user can log into this admin site. Even "
            "Superusers should have this status enabled, otherwise they won't "
            "be able to access the Admin Panel."
        )

        permission_groups_field = Select2MultipleField(
            model=PermissionGroup,
            required=False,
            label=_("Granular Permission Groups"),
            help_text=_(
                "Use Permission Groups to granularly give more permissions. User "
                "can belong to many groups and their permissions add and stack together. "
                "Search for `Permission Groups` to change these and add them to "
                "multiple users. Go to user account -> `Actions` -> `Edit Main "
                "Permissions` to add them to a specific user. Will not influence "
                "Superusers as they already have all the rights and can't be "
                "stripped of them without removing Superuser status first."
            )
        )
        initial_groups = self._get_initial_groups()
        permission_groups_field.initial = [group.pk for group in initial_groups]
        permission_groups_field.widget.choices = [(group.pk, force_text(group)) for group in initial_groups]
        self.fields["permission_groups"] = permission_groups_field

    def _get_initial_groups(self):
        if self.instance.pk and hasattr(self.instance, "groups"):
            return self.instance.groups.all()
        else:
            return []

    def clean_old_password(self):
        """
        Validates that the `old_password` field is correct.
        """
        old_password = self.cleaned_data["old_password"]
        if not self.changing_user.check_password(old_password):
            raise forms.ValidationError(
                _("Your old password was entered incorrectly. Please enter it again."),
                code='password_incorrect',
            )
        return old_password

    def clean_members(self):
        members = self.cleaned_data.get("members", [])
        return get_user_model().objects.filter(pk__in=members).all()

    def clean_permission_groups(self):
        permission_groups = self.cleaned_data.get("permission_groups", [])
        return PermissionGroup.objects.filter(pk__in=permission_groups)

    def clean(self):
        for field in ("is_staff", "is_superuser"):
            if field not in self.cleaned_data:
                continue

            flag = self.cleaned_data[field]
            if self.changing_user == self.instance and not flag:
                self.add_error(field, _(
                    "You can't unset this status for yourself "
                    "due to security reasons. Use another account if you want to "
                    "remove permissions for this particular account.")
                )
        return self.cleaned_data

    def save(self):
        obj = super(PermissionChangeFormBase, self).save()
        obj.groups.clear()
        obj.groups.set(self.cleaned_data["permission_groups"])
Exemple #23
0
class PasswordResetForm2(forms.Form):
	password = forms.CharField(max_length = 64, widget = forms.PasswordInput(attrs = {'class':'validate', 'id':'confirm_passwd','onfocus':'setInterval(validatePassword, 400)',}))
Exemple #24
0
class LoginForm(forms.Form):  #登录
    username = forms.CharField()
    password = forms.CharField(widget=forms.PasswordInput)
Exemple #25
0
class WordForm(forms.Form):
    word = forms.CharField(max_length=1024)
Exemple #26
0
class LoginForm(forms.Form):
    email = forms.EmailField(label = 'Email ', widget=forms.TextInput(attrs={'placeholder' : 'Enter email'}))
    password = forms.CharField(label = 'Password ', widget=forms.PasswordInput(attrs={'placeholder' : 'Enter password'}))
Exemple #27
0
class FailRedirectForm(BaseRobokassaForm):
    """Форма приема результатов для перенаправления на страницу Fail"""

    OutSum = forms.CharField(max_length=15)
    InvId = forms.IntegerField(min_value=0)
    Culture = forms.CharField(max_length=10)
Exemple #28
0
class EventForm(forms.Form):
    bridgenumber = forms.CharField(max_length=10)
    eventfile = forms.FileField()
Exemple #29
0
class SearchForm(forms.Form):
    query = forms.CharField(max_length=200, help_text="Query: ")
class SearchForm(forms.Form):
    query = forms.CharField(max_length=200)
    cat_id = forms.IntegerField()