[英]How to remove the Username field from the UserCreationForm in Django
[英]When i create usercreationform in django the username field is auto selected and how can i fix it
請分享您的 forms.py 文件並嘗試通過 label 更改用戶名字段:
class UserCreateForm(UserCreationForm):
class Meta():
model = get_user_model()
fields = ('username','email','password1','password2')
def __init__(self,*args,**kwargs):
super().__init__(*args,**kwargs)
self.fields['username'].label = 'User Name'
self.fields['email'].label = 'Email Address'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.