Opened 2 years ago

Closed 2 years ago

#23017 closed Bug (invalid)

Default Managers

Reported by: rbatukaev@… Owned by: nobody
Component: contrib.auth Version: 1.7-rc-1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When I do not define any managers, I get no errors. However, when I do the following:

class User(AbstractUser):
    # some fields
    objects = model.Manager()
    hstore_manager = hstore.HStoreManager()

I get

AttributeError at'Manager' object has no attribute 'get_by_natural_key'

There is something wrong with /django/contrib/auth/backends.py in authenticate method on this line:

user = UserModel._default_manager.get_by_natural_key(username)

Change History (2)

comment:1 Changed 2 years ago by rbatukaev@…

Summary: Custom ManagersDefault Managers

comment:2 Changed 2 years ago by Tim Graham

Resolution: invalid
Status: newclosed

The default manager should inherit from BaseUserManager or implement its methods.

Note: See TracTickets for help on using tickets.
Back to Top