[Django] #23017: Custom Managers

58 views
Skip to first unread message

Django

unread,
Jul 13, 2014, 7:54:42 AM7/13/14
to django-...@googlegroups.com
#23017: Custom Managers
------------------------------+----------------------
Reporter: rbatukaev@… | Owner: nobody
Type: Bug | Status: new
Component: contrib.auth | Version: 1.7-rc-1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+----------------------
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)
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23017>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 13, 2014, 8:00:09 AM7/13/14
to django-...@googlegroups.com
#23017: Default Managers
------------------------------+--------------------------------------

Reporter: rbatukaev@… | Owner: nobody
Type: Bug | Status: new
Component: contrib.auth | Version: 1.7-rc-1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by rbatukaev@…):

* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/23017#comment:1>

Django

unread,
Jul 13, 2014, 5:59:06 PM7/13/14
to django-...@googlegroups.com
#23017: Default Managers
------------------------------+--------------------------------------
Reporter: rbatukaev@… | Owner: nobody
Type: Bug | Status: closed
Component: contrib.auth | Version: 1.7-rc-1
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by timo):

* status: new => closed
* resolution: => invalid


Comment:

The default manager should inherit from
[https://docs.djangoproject.com/en/dev/topics/auth/customizing/#django.contrib.auth.models.BaseUserManager
BaseUserManager] or implement its methods.

--
Ticket URL: <https://code.djangoproject.com/ticket/23017#comment:2>

Reply all
Reply to author
Forward
0 new messages