【发布时间】:2019-08-12 16:44:02
【问题描述】:
我正在制作注册页面,但我不喜欢用户名下的文字,例如:
Required 150 characters or fewer. Letters, digits and @/./+/-/_ only。
或在密码下:
Your password can't be too similar to your other personal information.
你明白了
请帮忙,谢谢
我试图找到其他问题,但它们都将 help_text 从添加的字段中删除为电子邮件,但我需要从用户名、密码中删除...
class UserRegisterForm(UserCreationForm):
email = forms.EmailField()
class Meta:
model = User
fields = ['username', 'email' , 'password1', 'password2']
然后我将其以 html 格式呈现为酥脆的形式
<form method="POST">
{% csrf_token %}
<fieldset>
<legend class="hello4">
<i>Join Today</i>
</legend>
<div >
{{form|crispy}}
</div>
</fieldset>
<div>
<button type="submit" class="btn btn-light">Sign Up</button>
</div>
</form>
【问题讨论】:
-
您能否准确判断您是只想删除文本,还是也禁用验证逻辑?