Opened 4 years ago
Last modified 4 years ago
#32035 closed Bug
AbstractUser.clean assumes default manager is named objects — at Version 1
Reported by: | Ben Brooks | Owned by: | nobody |
---|---|---|---|
Component: | contrib.auth | Version: | 3.1 |
Severity: | Normal | Keywords: | |
Cc: | ben@… | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description (last modified by )
From Managers documentation (https://docs.djangoproject.com/en/3.1/topics/db/managers/), "If you’re writing some code that must handle an unknown model, for example, in a third-party app that implements a generic view, use this manager (or _base_manager) rather than assuming the model has an objects manager."
Our third-party app implements a generic view (with objects = None) and set the default manager to be something else. When making calls to inherited methods, we run into NoneType errors due to normalize_email() implementation. The associated PR replaces objects with _default_manager to allow for the generic view implementation.