Я хочу оформить свою форму. И мне нужно добавить заполнитель для всех входов, но не могу добавить заполнитель для пароля1 и пароля2.
Я пытался:
class RegistrationForm(UserCreationForm):
"""
The registration form that inherits UserCreationForm.
Fiels:
['email', 'username', 'password', 'password_repeat']
Windgets:
For all inputs we creates atributte class: .signup_input
"""
class Meta:
model = Account
fields = ['email', 'username', 'password1', 'password2']
widgets = {
'email': forms.TextInput(attrs={'placeholder': 'Email'}),
'username': forms.TextInput(attrs={'placeholder': 'Type your username'}),
'password1': forms.TextInput(attrs={'placeholder': 'Choose a password'}),
'password2': forms.PasswordInput(attrs={'placeholder':'Confirmar Password'}),
}
это моя модель:
class Account(AbstractBaseUser):
"""
The class Account inherits AbstractBaseUser.
This is a model for users.
Fields:
['email', 'username', 'date_joined', 'is_active',
'is_moderator', 'is_admin', 'is_superuser', 'is_staff']
Model manager is:
objects = MyAccountManager()
"""
email = models.EmailField(max_length=20, unique=True, verbose_name='email')
username = models.CharField(max_length=12, unique=True)
date_joined = models.DateTimeField(auto_now_add=True, verbose_name='date joined')
is_active = models.BooleanField(default=True)
is_moderator = models.BooleanField(default=False)
is_admin = models.BooleanField(default=False)
is_superuser = models.BooleanField(default=False)
is_staff = models.BooleanField(default=False)
#What user will put into form
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = ['username',]
Как добавить заполнитель к паролю1 и паролю2? Спасибо)