Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CreatePerson(forms.ModelForm):
- class Meta(object):
- model = Profile
- fields = ('username', 'password', 'first_name', 'last_name', 'email', 'City', 'Sex', 'Age',) # exclude
- labels = {
- 'username': 'Введите желаемый логин',
- 'password': 'Пароль',
- 'first_name': 'Имя',
- 'last_name': 'Фамилия либо Отчество',
- 'email': 'Почта',
- }
- help_texts = {
- 'username': (''),
- }
- widgets = {
- 'password': forms.PasswordInput(attrs={'placeholder': 'Pass'}),
- }
- def __init__(self, *args, **kwargs):
- super(CreatePerson, self).__init__(*args, **kwargs)
- self.fields['Sex'].empty_label = 'choose'
- validators=[EmailValidator(message="Your message")]
- for field in self.fields.itervalues():
- field.widget.attrs.update({'class':'user'})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement