Exemple #1
0
class UserCreationForm(forms.UserCreationForm):
    email = EmailField(
        required=True,
        widget=EmailInput(
            attrs={'class': 'form-control',
                   'aria-describedby': 'signup-form-email-help',
                   'placeholder': '*****@*****.**'}
        )
    )

    class Meta:
        model = User
        fields = ('username', 'email')
        field_classes = {'username': forms.UsernameField, 'email': EmailField}

    def __init__(self, *args, **kwargs):
        super(UserCreationForm, self).__init__(*args, **kwargs)

        self.__adjust_username_field()
        self.__adjust_password_field(1)
        self.__adjust_password_field(2)

    def save(self, commit=True):
        user = super(UserCreationForm, self).save(commit=False)
        user.email = self.cleaned_data['email']
        user.is_active = False
        if commit:
            user.save()
        self.__send_signup_email(user)
        return user

    def __send_signup_email(self, user):
        html = render_to_string('registration/signup_email.html', {
            'user': user,
        })
        send_mail(
            'ReCarGuide — verify your email',
            html,
            '*****@*****.**',
            [user.email],
            fail_silently=False,
        )

    def __adjust_username_field(self):
        old_attrs = self.fields['username'].widget.attrs
        new_attrs = {'class': 'form-control',
                     'aria-describedby': 'signup-form-username-help',
                     'placeholder': 'johndoe1970'}
        self.fields['username'].widget.attrs = {**old_attrs, **new_attrs}

    def __adjust_password_field(self, num):
        name = 'password{}'.format(str(num))
        old_attrs = self.fields[name].widget.attrs
        new_attrs = {'class': 'form-control',
                     'aria-describedby': 'signup-form-{}-help'.format(name),
                     'placeholder': 's3cr3tp@$$w0rD'}
        self.fields[name].widget.attrs = {**old_attrs, **new_attrs}
Exemple #2
0
 class Meta:
     model = User
     fields = [
         'email',
         #'user__email'
     ]
     widgets = {
         'email': EmailInput(attrs={'class': 'form-control', 'style': 'width:100%;'}),
     }
 class Meta:
     model = User
     fields = ('username', 'email', 'first_name', 'last_name')
     widgets = {
         'username': TextInput(attrs={'class': 'form-control', 'placeholder': 'Kullanıcı Adı'}),
         'email': EmailInput(attrs={'class': 'form-control', 'placeholder': 'Email'}),
         'first_name': TextInput(attrs={'class': 'form-control', 'placeholder': 'İsim'}),
         'last_name': TextInput(attrs={'class': 'form-control', 'placeholder': 'Soyisim'})
     }
Exemple #4
0
    class Meta:
        model = Guest
        fields = ['name', 'e_mail', 'reg_info']

        widgets = {
            'name': TextInput(attrs={'class': 'form-control'}),
            'e_mail': EmailInput(attrs={'class': 'form-control'}),
            'reg_info': Textarea(attrs={'class': 'form-control'}),
        }
Exemple #5
0
 class Meta:
     model = User
     fields = ['username', 'first_name', 'last_name', 'email','password']
     widgets = {
         'first_name': TextInput(attrs={'class': 'form-control'}),
         'last_name': TextInput(attrs={'class': 'form-control'}),
         'email': EmailInput(attrs={'class': 'form-control','required': True}),
         'username': TextInput(attrs={'class': 'form-control'}),                       
     }
 class Meta:
     model = User
     fields = ["first_name", "last_name", "username", "email", "password"]
     widgets = {
         'first_name': TextInput(attrs={'class': 'form-control', 'placeholder': 'Ex : Jean'}),
         'last_name': TextInput(attrs={'class': 'form-control', 'placeholder': 'Ex : Martin'}),
         'email': EmailInput(attrs={'class': 'form-control', 'placeholder': 'Ex : [email protected]'}),
         'password': PasswordInput(attrs={'class': 'form-control', 'placeholder': 'Ex : 32hg65ez98hj'})
     }
Exemple #7
0
 class Meta:
     model = ContactMessage
     fields = ['name', 'email', 'subject', 'message']
     widgets = {
         'name': TextInput(attrs={'class': 'input', 'placeholder': 'Name & Sure name'}),
         'email': EmailInput(attrs={'class': 'input', 'placeholder': 'Write your email'}),
         'subject': TextInput(attrs={'class': 'input', 'placeholder': 'Write your Subjects'}),
         'message': TextInput(attrs={'class': 'input', 'placeholder': 'Write your messages'}),
     }         
 class Meta:
     model = User
     fields = ['firstName', 'lastName', 'email', 'userName']
     widgets = {
         'firstName': TextInput(attrs={'class': 'input', 'placeholder': 'First Name'}),
         'lastName': TextInput(attrs={'class': 'input', 'placeholder': 'Last Name'}),
         'email': EmailInput(attrs={'class': 'input', 'placeholder': 'Email'}),
         'userName': TextInput(attrs={'class': 'input', 'placeholder': 'User Name', 'readonly': 'readonly'})
     }
Exemple #9
0
 class Meta:
     model = Enquirer
     fields = '__all__'
     widgets = {
         'name': TextInput(attrs={'placeholder': 'Name'}),
         'school': TextInput(attrs={'placeholder': 'School'}),
         'email': EmailInput(attrs={'placeholder': 'Email'}),
         'phone': TextInput(attrs={'placeholder': 'Phone'})
     }
Exemple #10
0
    class Meta:
        model = User
        fields = ['first_name', 'last_name', 'email']

        widgets = {
            'first_name': TextInput(attrs={'class': 'form-control'}),
            'last_name': TextInput(attrs={'class': 'form-control'}),
            'email': EmailInput(attrs={'class': 'form-control'}),
        }
Exemple #11
0
 class Meta:
     model = User
     fields = ('username', 'first_name', 'last_name', 'email')
     widgets = {
         'username': TextInput(attrs={'class': 'validate'}),
         'first_name': TextInput(attrs={'class': 'validate'}),
         'last_name': TextInput(attrs={'class': 'validate'}),
         'email': EmailInput(attrs={'class': 'validate'})
     }
Exemple #12
0
 class Meta:
     model = User
     fields = ['name', 'username', 'password', 'email']
     widgets = {
         'name': TextInput(attrs={'placeholder': 'Name'}),
         'username': TextInput(attrs={'placeholder': 'username'}),
         'password': PasswordInput(attrs={'placeholder': 'password'}),
         'email': EmailInput(attrs={'placeholder': 'email'})
     }
Exemple #13
0
 class Meta:
     model = User
     fields = ('username', 'email', 'first_name', 'last_name')
     widgets = {
         'username': TextInput(attrs={'class': 'form-control', 'placeholder': 'Username'}),
         'email': EmailInput(attrs={'class': 'form-control', 'placeholder': 'E-mail'}),
         'first_name': TextInput(attrs={'class': 'form-control', 'placeholder': 'First Name'}),
         'last_name': TextInput(attrs={'class': 'form-control', 'placeholder': 'Last Name'}),
     }
Exemple #14
0
 class Meta:
     model = User
     fields = ['email']
     widgets = {
         'username'  : TextInput(attrs={'class': 'input','placeholder':'username'}),
         'email'     : EmailInput(attrs={'class': 'input','placeholder':'email'}),
         'first_name': TextInput(attrs={'class': 'input','placeholder':'first_name'}),
         'last_name' : TextInput(attrs={'class': 'input','placeholder':'last_name' }),
     }
Exemple #15
0
class CustomPasswordResetForm(PasswordResetForm):
    email = EmailField(max_length=128,
                       widget=EmailInput(attrs={
                           'class': 'input',
                           'placeholder': 'Email Address'
                       }))

    class Meta:
        fields = ('email', )
Exemple #16
0
class UpdateForm(Form):
    email = EmailField(label="邮箱",
                       widget=EmailInput(
                           attrs={'placeholder': '邮箱'}
                       ),
                       error_messages={
                           'required': "邮箱不能为空",
                           "invalid": "邮箱格式不正确"
                       })
Exemple #17
0
class EmailPostForm(Form):
    name = CharField(max_length=25,
                     widget=TextInput(attrs={
                         'class': 'form-control',
                         'placeholder': 'Enter name',
                     }))
    email = EmailField(widget=EmailInput(attrs={
        'class': 'form-control',
        'placeholder': 'Enter your email',
    }))
    to = EmailField(widget=EmailInput(attrs={
        'class': 'form-control',
        'placeholder': 'Enter email',
    }))
    comments = CharField(required=False, widget=Textarea(attrs={
        'class': 'form-control',
        'placeholder': 'Your comments',
    }))
Exemple #18
0
class PasswordRemindForm(PasswordResetForm):
    email = EmailField(
        max_length=254,
        widget=EmailInput(attrs={
            'autofocus': True,
            'class': 'form-control',
            'placeholder': 'Email'
        }),
        required=True)
Exemple #19
0
 class Meta:
     model = User
     fields = ('username', 'email', 'first_name', 'last_name')
     widgets = {
         'username'  : TextInput(attrs={'class=form-control valid' :  'input', 'placeholder' : 'username'}),
         'email'     : EmailInput(attrs={'class=form-control valid':  'input', 'placeholder' : 'email'}),
         'first_name': TextInput(attrs={'class=form-control valid' :  'input', 'placeholder' : 'first_name'}),
         'last_name' : TextInput(attrs={'class=form-control valid' :  'input', 'placeholder' : 'last_name'}),
     }
Exemple #20
0
 class Meta:
     model=User
     fields=['username','email','first_name','last_name']
     widgets={
         'username':TextInput(attrs={'class':'input','placeholder':'User Name'}),
         'email':EmailInput(attrs={'class':'input','placeholder':'Write Your Email'}),
         'first_name':TextInput(attrs={'class':'input','placeholder':'Your First Name'}),
         'last_name':TextInput(attrs={'class':'input','placeholder':'Your Last Name '})
     }
Exemple #21
0
 class Meta:
     model = Contact
     fields = '__all__'
     labels = {'name': 'Nom', 'email': 'E-mail', 'message': 'Message'}
     widgets = {
         'name': TextInput(attrs={'class': 'form-control'}),
         'email': EmailInput(attrs={'class': 'form-control'}),
         'message': Textarea(attrs={'class': 'form-control'})
     }
Exemple #22
0
 class Meta:
     model = User
     fields = ('first_name', 'last_name', 'email', 'username', 'password')
     widgets = {
         'first_name': TextInput(attrs={'required': 'true'}),
         'last_name': TextInput(attrs={'required': 'true'}),
         'email': EmailInput(attrs={'required': 'true'}),
         'password': PasswordInput(),
     }
Exemple #23
0
 class Meta:
     model = User
     fields = ('username', 'email', 'first_name', 'last_name')
     widgets = {
         'username': TextInput(attrs={'placeholder': 'username'}),
         'email': EmailInput(attrs={'placeholder': 'email'}),
         'first_name': TextInput(attrs={'placeholder': 'first name'}),
         'last_name': TextInput(attrs={'placeholder': 'last name'}),
     }
Exemple #24
0
 class Meta:
     model = User
     fields = ('username', 'email', 'phone_number', 'is_teacher', 'is_student')
     widgets = {
         'email': EmailInput(attrs={'class': 'form-control', 'placeholder': 'Email'}),
         'username': TextInput(attrs={'class': 'form-control', 'placeholder': 'Username'}),
         'phone_number': TextInput(
             attrs={'class': 'form-control', 'placeholder': 'Enter Phone Number'})
     }
Exemple #25
0
class RegisterForm(forms.Form):
    username = forms.CharField(widget=TextInput(
        attrs={
            'placeholder': 'Username',
            'class': 'input-text',
            'id': 'name',
            'autocomplete': 'off',
            'required': 'required'
        }))

    first_name = forms.CharField(widget=TextInput(
        attrs={
            'name': 'first_name',
            'placeholder': 'First name',
            'class': 'input-text',
            'id': 'full-name',
            'autocomplete': 'off',
            'required': 'required'
        }))

    last_name = forms.CharField(widget=TextInput(
        attrs={
            'name': 'last_name',
            'placeholder': 'Last name',
            'class': 'input-text',
            'id': 'name',
            'autocomplete': 'off',
        }))

    email = forms.EmailField(widget=EmailInput(
        attrs={
            'name': 'email',
            'placeholder': 'Your email',
            'class': 'input-text',
            'id': 'email',
            'autocomplete': 'off',
            'pattern': '[^@]+@[^@]+.[a-zA-Z]{2,6}'
        }))

    password1 = forms.CharField(widget=PasswordInput(
        attrs={
            'name': 'password1',
            'placeholder': 'Your password',
            'id': 'password',
            'class': 'input-text',
            'autocomplete': 'off'
        }))

    password2 = forms.CharField(widget=PasswordInput(
        attrs={
            'name': 'password2',
            'placeholder': 'Confirm password',
            'id': 'password',
            'class': 'input-text',
            'autocomplete': 'off'
        }))
Exemple #26
0
 class Meta:
     model = Player
     fields = '__all__'
     widgets = {
         'name':
         TextInput(
             attrs={
                 'type': "text",
                 'id': "LastName",
                 'name': "LastName",
                 'placeholder': "Nom",
                 'class': "input-xlarge"
             }),
         'firstname':
         TextInput(
             attrs={
                 'type': "text",
                 'id': "FirstName",
                 'name': "FirstName",
                 'placeholder': "Prénom",
                 'class': "input-xlarge"
             }),
         'email':
         EmailInput(
             attrs={
                 'type': "email",
                 'id': "email",
                 'name': "email",
                 'placeholder': "Adresse E-mail",
                 'class': "input-xlarge"
             }),
         'dateNaissance':
         DateInput(
             attrs={
                 'type': "date",
                 'id': "dateNaissance",
                 'name': "dateNaissance",
                 'placeholder': "Date de Naissance",
                 'class': "input-xlarge"
             }),
         'pseudo':
         TextInput(
             attrs={
                 'type': "text",
                 'id': "Pseudo",
                 'name': "Pseudo",
                 'placeholder': "Pseudo",
                 'class': "input-xlarge"
             }),
         # 'img_player': FileInput(attrs={
         #     'type':"file",
         #     'name':"LastName",
         #     'placeholder':"Nom",
         #     'class':"btn btn-outline-primary"
         #                   }),
     }
Exemple #27
0
    class Meta(UserCreationForm):
        model = CustomUser
        fields = ('email', 'name', 'organization', 'country')

        widgets = {
            'email':
            EmailInput(attrs={
                'class': 'form-control',
                'required': True,
                'placeholder': 'Email'
            }),
            'name':
            TextInput(attrs={
                'class': 'form-control',
                'required': True,
                'placeholder': 'Name'
            }),
            'organization':
            TextInput(
                attrs={
                    'class': 'form-control',
                    'required': True,
                    'placeholder': 'Organization'
                }),
            'country':
            Select(attrs={
                'class': 'form-control',
                'required': True,
                'placeholder': 'Country'
            },
                   choices=c.getCountries()),
            #    'is_superuser':CheckboxInput(attrs={'class':'form-control inline-element', 'label':'Is Super User', 'required':False}),
            #    'is_active':CheckboxInput(attrs={'class':'form-control inline-element', 'label':'Is Active', 'required':False}),
            #    'is_staff':CheckboxInput(attrs={'class':'form-control inline-element', 'label':'Is Staff', 'required':False}),
            'password1':
            PasswordInput(
                attrs={
                    'class':
                    'form-control',
                    'required':
                    True,
                    'autocomplete':
                    False,
                    'placeholder':
                    'Password',
                    'help_text':
                    password_validation.password_validators_help_text_html()
                }),
            'password2':
            PasswordInput(
                attrs={
                    'class': 'form-control',
                    'required': True,
                    'placeholder': 'Password Confirmation'
                }),
        }
Exemple #28
0
 class Meta:
     model = User
     fields = ['email']
     widgets = {
         'email':
         EmailInput(attrs={
             'class': 'form-control',
             'placeholder': 'username'
         }),
     }
Exemple #29
0
 class Meta:
     model = User
     fields = ['group', 'email', 'phone_number', 'building', 'room']
     widgets = {
         'group': Select(attrs={'class': 'form-control', 'id': 'inputGroup'}),
         'email': EmailInput(attrs={'class': 'form-control', 'id': 'inputEmail', 'placeholder': '*****@*****.**'}),
         'phone_number': TextInput(attrs={'class': 'form-control', 'id': 'inputPhoneNumber', 'placeholder': '06******'}),
         'building': Select(attrs={'class': 'form-control', 'id': 'inputBuilding'}),
         'room': Select(attrs={'class': 'form-control', 'id': 'inputRoom'}),
     }
Exemple #30
0
 class Meta():
     model = PyUser
     fields = ('email', )
     widgets = {
         'email':
         EmailInput(attrs={
             'class': 'form-control',
             'placeholder': _('Email')
         }),
     }