Please consider also that:
using modelname._default_manager returns the name of the custom
manager correctly so
the manager is set well.

2006/11/16, doubtintom <[EMAIL PROTECTED]>:
>
> When a model contains (along with other fields):
> owner = models.ForeignKey(User, related_name="owner", blank=True,
> editable=False)
>
>     class Admin:
>         list_filter = ('owner',)
>         pass
>
> Then the admin interface has a filter for records by owner with this
> url:
> http://localhost:8000/admin/projects/project/?owner__id__exact=1
>
>  We want to use a manager something like this to do the filtering
> according to the logged in user:
> class ProjManager(models.Manager):
>     def get_query_set(self):
>         user = threadlocals.get_current_user()
>         return(super(ProjManager,
> self).get_query_set().filter(owner__id__exact=user.<???>))
>
> where the question marks are unknown syntax. That is the first
> question, what is the correct syntax?
>
> A sticky point is that even with test code like this:
>          return(super(ProjManager,
> self).get_query_set().filter(owner__id__exact=1))
> the admin interface does not get a filtered list of objects, but lists
> all objects. So the manager has not been honored. And yet, when testing
> through the shell interface, the manager's filter works as expected,
> i.e. it filters correctly.
>
> Insights anyone?
>
> Tom
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to