On Mon, Feb 23, 2009 at 8:03 AM, happy <madew...@gmail.com> wrote: > > Hello All, > > I would like to change the objects manager for a Worker class such > that it only outputs workers for which the user auth.user is active in > the system. The idea is to make invisible the workers that do not > have an active account. The problem if I do that is that the inactive > workers will also disappear from the admin. > > As this is too annoying for me. currently, I have just added another > manager named active_objects and replaced Worker.objects by > Worker.active_objects everywhere in my code. > The problem with this approach is that it does not work well with > one_to_many or many_to_many relationships manager. These still show > the inactive users. > > What is the clean way to do this ? > > > See this bit in the docs: http://docs.djangoproject.com/en/dev/topics/db/managers/#using-managers-for-related-object-access
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 -~----------~----~----~----~------~----~------~--~---