I have already multiple managers...

This is needed in order to override the default behaviour in an
application instance, but not in another one...




On 23 Feb, 15:06, Alex Gaynor <alex.gay...@gmail.com> wrote:
> On Mon, Feb 23, 2009 at 5:38 AM, fero <elf...@gmail.com> wrote:
>
> > 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 ?
>
> It would be far easier for you to just create a single custom manager and
> then add several methods onto it, instead of having multiple managers.
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to