As stated there is no way to filter on any non-field attribute,
property or method.

However, don't despair. If the result of your permission check can be
expressed as another Django query then it should be possible to
construct something in the ORM that uses this. That said, we have had
trouble with highly complex permissions and large querysets and have
had to come up with a permissions caching mechanism so that our site
doesn't do too many queries per page.

Good luck, Euan

On Jul 7, 1:47 am, Wiiboy <jordon...@gmail.com> wrote:
> > As I understand it, parameters passed to filter() are translated into SQL
> > statements.  An arbitrary python method that you write for your object can
> > do any number of things, which might not be translatable into SQL.  So I
> > don't see how any "filter on the result of any method" feature would work,
> > other than doing exactly the implementation you describe.
>
> Curses, that's what I thought.
>
> > However, your specific use case sounds like it should be possible to avoid
> > iterating over everything by changing your model.  Is there a reason why
> > each Permission model can't have a ManyToMany field with the set of users
> > allowed by that permission model?
>
> That'd be really hard to maintain,  I think.  I'd have to evaluate
> whether the current user could view _every_ article every time they
> changed their profile, registered, etc.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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