我试图改变基本的标志形式,并做了以下风格
from django import forms
from django.contrib.auth.forms import UserCreationForm
from .models import Product
from userprofile.models import Customer
from django.forms import TextInput, EmailInput, PasswordInput
from django.contrib.auth.models import User
class CrateUserForm(UserCreationForm):
class Meta:
model = User
fields= ['username', 'email', 'password1', 'password2',]
widgets = {
'username': forms.TextInput(attrs={
'class': 'w-100 p-3 rounded-4 border border-success shadow',
'placeholder': 'Exemplu1234',
}),
'email': forms.EmailInput(attrs={
'class': 'w-100 p-3 rounded-4 border border-success shadow',
'placeholder': 'exemplu@email.com',
}),
'password1': forms.PasswordInput(attrs={
'class': 'w-100 p-3 rounded-4 border border-success shadow',
}),
'password2': forms.PasswordInput(attrs={
'class': 'w-100 p-3 rounded-4 border border-success shadow',
}),
}
现在我的问题是,两个密码的字段没有改变,而其他两个做了。我怎样才能让它们工作?
我试图重新排序字段,但没有任何变化。
1条答案
按热度按时间zzwlnbp81#
您需要像这样覆盖两个密码字段,我认为它应该可以工作...