Opened 16 years ago
Closed 16 years ago
#10311 closed (invalid)
Overriding the default manager at "import-time"
Reported by: | fero | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.0 |
Severity: | Keywords: | 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
I tried to override the default manager
when I am importing my views.
I noticed that I needed to do override both;
- objects attribute
- _default_manager attribute
In my views module I do something like
from app.models import MyModel from app.models.managers import MyManager MyModel.add_to_class('objects', MyManager()) MyModel.add_to_class('_default_manager', MyManager())
Overriding the '_default_manager' attribute is needed in order to make
the AnyModel.foreingKey_set working with the new custom manager.
Is it correct and/or safe ?
Note:
See TracTickets
for help on using tickets.
The tracker is for bugs and enhancement requests. This seems to be a question, and would be better posed on django-users.