【发布时间】:2018-08-30 23:27:31
【问题描述】:
我尝试在我的注册表单中使用 4 个字段启用占位符:电话、电子邮件、密码 1、密码 2。前两个字段都正确,但密码字段不起作用。
forms.py
from django import forms
from django.contrib.auth.forms import UserCreationForm
from customuser.models import User
from django.forms import TextInput,EmailInput,PasswordInput
class SignUpForm(UserCreationForm):
class Meta:
model = User
fields = ('phone', 'email', 'password1', 'password2', 'is_client','is_partner')
widgets = {
'email': EmailInput(attrs={'class': 'form-control', 'placeholder': 'Email adress'}),
'phone': TextInput(attrs={'class': 'form-control', 'placeholder': 'Phone number +79011234567'}),
'password1': PasswordInput(attrs={'class': 'form-control', 'placeholder': 'Password from numbers and letters of the Latin alphabet'}),
'password2': PasswordInput(attrs={'class': 'form-control', 'placeholder': '
Password confirmation'}),
}
【问题讨论】:
标签: django