コード例 #1
0
ファイル: forms.py プロジェクト: resurtm/recarguide
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}
コード例 #2
0
 class Meta:
     model = User
     fields = [
         'email',
         #'user__email'
     ]
     widgets = {
         'email': EmailInput(attrs={'class': 'form-control', 'style': 'width:100%;'}),
     }
コード例 #3
0
 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'})
     }
コード例 #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'}),
        }
コード例 #5
0
ファイル: forms.py プロジェクト: massariolmc/periciasmedicas
 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'}),                       
     }
コード例 #6
0
 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'})
     }
コード例 #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'}),
     }         
コード例 #8
0
 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'})
     }
コード例 #9
0
ファイル: forms.py プロジェクト: doutianye/hwcentral
 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'})
     }
コード例 #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'}),
        }
コード例 #11
0
ファイル: forms.py プロジェクト: scorsi/django-account-app
 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'})
     }
コード例 #12
0
ファイル: form.py プロジェクト: Cataholic/jms
 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'})
     }
コード例 #13
0
ファイル: forms.py プロジェクト: OnurBoynuegri/RentHome
 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'}),
     }
コード例 #14
0
ファイル: forms.py プロジェクト: gaberial31/front
 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' }),
     }
コード例 #15
0
ファイル: auth_forms.py プロジェクト: kenoalords/komotion
class CustomPasswordResetForm(PasswordResetForm):
    email = EmailField(max_length=128,
                       widget=EmailInput(attrs={
                           'class': 'input',
                           'placeholder': 'Email Address'
                       }))

    class Meta:
        fields = ('email', )
コード例 #16
0
ファイル: user_forms.py プロジェクト: blackmonkey121/blog
class UpdateForm(Form):
    email = EmailField(label="邮箱",
                       widget=EmailInput(
                           attrs={'placeholder': '邮箱'}
                       ),
                       error_messages={
                           'required': "邮箱不能为空",
                           "invalid": "邮箱格式不正确"
                       })
コード例 #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',
    }))
コード例 #18
0
class PasswordRemindForm(PasswordResetForm):
    email = EmailField(
        max_length=254,
        widget=EmailInput(attrs={
            'autofocus': True,
            'class': 'form-control',
            'placeholder': 'Email'
        }),
        required=True)
コード例 #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'}),
     }
コード例 #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 '})
     }
コード例 #21
0
ファイル: form.py プロジェクト: celiabellod/worldtraveling
 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'})
     }
コード例 #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(),
     }
コード例 #23
0
ファイル: forms.py プロジェクト: sahinmehmetemre/SellACAR
 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'}),
     }
コード例 #24
0
ファイル: forms.py プロジェクト: mbrsagor/blog
 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'})
     }
コード例 #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'
        }))
コード例 #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"
         #                   }),
     }
コード例 #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'
                }),
        }
コード例 #28
0
 class Meta:
     model = User
     fields = ['email']
     widgets = {
         'email':
         EmailInput(attrs={
             'class': 'form-control',
             'placeholder': 'username'
         }),
     }
コード例 #29
0
ファイル: forms.py プロジェクト: guitoof/tasdurab
 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'}),
     }
コード例 #30
0
ファイル: forms.py プロジェクト: codeshard/pyerp
 class Meta():
     model = PyUser
     fields = ('email', )
     widgets = {
         'email':
         EmailInput(attrs={
             'class': 'form-control',
             'placeholder': _('Email')
         }),
     }