【发布时间】:2010-11-08 13:29:01
【问题描述】:
在 django/django/contrib/auth/forms.py 如何覆盖默认方法 并在用户模块中包含相同的内容?
所以我的意图是我想将用户名字段长度更改为 64 个字符,但是在 django 目录中这样做是不正确的,因为每当下载新版本时,这个文件都必须更改......
究竟应该改变什么来做到这一点
class AuthenticationForm(forms.Form):
"""
Base class for authenticating users. Extend this to get a form that accepts
username/password logins.
"""
username = forms.CharField(label=_("Username"), max_length=30)
password = forms.CharField(label=_("Password"), widget=forms.PasswordInput)
【问题讨论】:
-
您到底想覆盖什么?有什么问题?
-
不要忘记
ALTERDBMS 中的用户表模式。因为auth_user的usename字段是30个字符长,任何超过30的字符串都会导致数据库级错误。
标签: python django django-models django-views