Beispiel #1
0
    def __init__(self, attrs=None, *args, **kwargs):
        """
        Have to pass a list of field types to the constructor, else we
        won't get any data to our compress method.
        """

        all_fields = (
            fields.EmailField(max_length=75),
            fields.EmailField(max_length=75, label=_("Verfiy Email Address")),
            )
        label = kwargs.pop('label', '') + ' (Enter twice to verify)'
        label = _(label)
        super(EmailVerificationField, self).__init__(all_fields, widget=EmailVerificationWidget(attrs={'class': 'form-control'}), label=label, *args, **kwargs)
Beispiel #2
0
    def __init__(self, attrs=None, *args, **kwargs):
        max_length = 75
        if 'max_length' in kwargs:
            max_length = kwargs['max_length']
            kwargs.pop('max_length', None)

        # widget = forms.TextInput(attrs={'class': 'form-control'})
        label = kwargs.pop('label', '')
        label = _(label)
        widget = EmailVerificationWidget(attrs={'class': 'form-control'})
        super(EmailVerificationField, self).__init__(max_length,
                                                     widget=widget,
                                                     label=label,
                                                     *args,
                                                     **kwargs)