Opened 9 years ago
Closed 9 years ago
#26589 closed Bug (worksforme)
apps.get_model doesn't build own Custom Manager
Reported by: | Tomas | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.9 |
Severity: | Normal | Keywords: | apps, manager |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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...>
Change History (4)
comment:1 by , 9 years ago
follow-up: 3 comment:2 by , 9 years ago
I suspected this was in a migration context, but that wasn't stated in the ticket. Sorry if this was not the case.
comment:3 by , 9 years ago
Replying to 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..
comment:4 by , 9 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Did you set the
use_in_migrations
attribute of your manager?https://docs.djangoproject.com/en/1.9/topics/migrations/#model-managers