On Thu, Oct 30, 2008 at 7:31 AM, Dennis Schmidt <[EMAIL PROTECTED]> wrote: > Well that does work, though in the Manager documentation it's said: > > "If you use custom Manager objects, take note that the first Manager > Django encounters (in the order in which they're defined in the model) > has a special status. Django interprets this first Manager defined in > a class as the "default" Manager, and several parts of Django (though > not the admin application) will use that Manager exclusively for that > model."
This is actually incorrect (open a ticket as a reminder and I'll fix the docs); by default, the admin now uses the default manager for the model, same as everything else in Django. As to your original question, ModelAdmin has a method named 'queryset()', which is used to obtain the QuerySet of objects for display in the admin lists and for looking up objects to edit. Overriding that method on your ModelAdmin subclass is the correct way to do this. This method receives the incoming HTTP request as an argument, so you can use it to filter based on some attribute of the request (e.g., the logged-in user). This also means that when overriding, you must define the method as "def queryset(self, request)", not just "def queryset(self)". -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

