我有用户模型(django用户模型)以及两种用于登录和用户创建的表格。
我想一步一步地讲。
我不想用登录表单输入的值来填充我的创建表单输入。
forms.py
class LoginForm(forms.Form):
username=forms.CharField(widget=forms.TextInput(attrs={'id':'LoginUserName'}))
password=forms.CharField(widget=forms.PasswordInput(attrs={'id':'LoginPassword'}))
class UserCreateForm(forms.ModelForm):
class Meta:
model = User
fields = ["username","password","first_name","last_name","email"]
widgets = {
'username':forms.TextInput(attrs={'id':'UserCreateName'}),
'password':forms.PasswordInput(attrs={'id':'UserCreatePw'}),
'first_name':forms.TextInput(),
'last_name':forms.TextInput(),
'email':forms.TextInput(),
}