Opened 5 years ago
Closed 5 years ago
#31289 closed Cleanup/optimization (fixed)
system checks: admin.E002 could provide a hint but doesn't
Reported by: | Keryn Knight | Owned by: | Sanskar Jaiswal |
---|---|---|---|
Component: | Core (System checks) | Version: | 3.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
Currently the output is:
myapp.MyCustomUserModel: (auth.E002) The field named as the 'USERNAME_FIELD' for a custom user model must not be included in 'REQUIRED_FIELDS'.
because I accidentally had:
USERNAME_FIELD = "email" EMAIL_FIELD = "email" REQUIRED_FIELDS = (USERNAME_FIELD, "full_name",)
Ignoring the fact that Django knows it's wrong to have it in there, and could easily just skip it or warn if it's not set, it doesn't make use of the hints available in system checks.
I'd like to suggest that a hint could be provided which says which field it's moaning about, something like (open to better wording):
HINT: Your username field is currently set to "email", you should remove "email" from your required fields definition.
It's a stupidly little thing, but having not had to make a custom user from scratch for a while, my eyes glazed over the not in must not be
and I was confused for all of 2 minutes before actually reading it properly.
Change History (5)
comment:1 by , 5 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | New feature → Cleanup/optimization |
comment:2 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 5 years ago
Patch needs improvement: | set |
---|
comment:4 by , 5 years ago
Has patch: | set |
---|---|
Patch needs improvement: | unset |
Triage Stage: | Accepted → Ready for checkin |
OK, fair enough. Got bandwidth for a patch?