[Django] #26589: apps.get_model doesn't build own Custom Manager

19 views
Skip to first unread message

Django

unread,
May 6, 2016, 6:13:39 AM5/6/16
to django-...@googlegroups.com
#26589: apps.get_model doesn't build own Custom Manager
----------------------------------------------+---------------------------
Reporter: tomasgarzon | Owner: nobody
Type: Bug | Status: new
Component: Database layer (models, ORM) | Version: 1.9
Severity: Normal | Keywords: apps, manager
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------------------+---------------------------
Something seems to be wrong when we use apps.get_model.

{{{
class A(models.Model):
objects = CustomClassAManager()
}}}

Bad:
{{{
Class1 = apps.get_model("miapp", "A")
print(Class1.objects)
<django.db.models.manager.Manager object at 0x7f1815c69198>
}}}

Class1.objects should be a instance of "CustomClassAManager".

Good:
{{{
from miapp.models import A
print(A.objects)
<miapp.managers.CustomClassAManager object at 0x...>
}}}

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

Django

unread,
May 6, 2016, 6:45:08 AM5/6/16
to django-...@googlegroups.com
#26589: apps.get_model doesn't build own Custom Manager
-------------------------------------+-------------------------------------

Reporter: tomasgarzon | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.9
(models, ORM) |
Severity: Normal | Resolution:

Keywords: apps, manager | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

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


Comment:

Did you set the `use_in_migrations` attribute of your manager?
https://docs.djangoproject.com/en/1.9/topics/migrations/#model-managers

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

Django

unread,
May 6, 2016, 6:46:21 AM5/6/16
to django-...@googlegroups.com
#26589: apps.get_model doesn't build own Custom Manager
-------------------------------------+-------------------------------------

Reporter: tomasgarzon | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.9
(models, ORM) |
Severity: Normal | Resolution:
Keywords: apps, manager | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by claudep):

I suspected this was in a migration context, but that wasn't stated in the
ticket. Sorry if this was not the case.

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

Django

unread,
May 6, 2016, 7:03:54 AM5/6/16
to django-...@googlegroups.com
#26589: apps.get_model doesn't build own Custom Manager
-------------------------------------+-------------------------------------

Reporter: tomasgarzon | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.9
(models, ORM) |
Severity: Normal | Resolution:
Keywords: apps, manager | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by tomasgarzon):

Replying to [comment:2 claudep]:


> I suspected this was in a migration context, but that wasn't stated in
the ticket. Sorry if this was not the case.

Exactly, it was in migrations... Sorry for the inconvenience..

--
Ticket URL: <https://code.djangoproject.com/ticket/26589#comment:3>

Django

unread,
May 6, 2016, 8:05:00 AM5/6/16
to django-...@googlegroups.com
#26589: apps.get_model doesn't build own Custom Manager
-------------------------------------+-------------------------------------
Reporter: tomasgarzon | Owner: nobody
Type: Bug | Status: closed

Component: Database layer | Version: 1.9
(models, ORM) | Resolution:
Severity: Normal | worksforme

Keywords: apps, manager | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

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


--
Ticket URL: <https://code.djangoproject.com/ticket/26589#comment:4>

Reply all
Reply to author
Forward
0 new messages