Re: Filter QuerySet using Manager

2006-10-12 Thread samuraisam
Thanks, Malcom. I think I figured out what I need to do: if request.user.is_anonymous(): return posts which are marked "public" (easy) if request.user.is_logged_in(or whatever the method is): return posts which are marked "protected" (easy) also return posts which are marked "restricted" (

Re: Filter QuerySet using Manager

2006-10-12 Thread samuraisam
Another question: how can I check if a related field contains something? Thanks, Sam --~--~-~--~~~---~--~~ 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@googlegro

Re: Filter QuerySet using Manager

2006-10-11 Thread Malcolm Tredinnick
On Wed, 2006-10-11 at 23:27 +, samuraisam wrote: > Hi guys and gals, this is my first post to django-users. > > My problem: I need to filter a QuerySet, possibly using a Manager but > I'm lost at how to do it. For example: > > class Special(models.Model): > PERMS = (('by user', 'restrict

Re: Filter QuerySet using Manager

2006-10-11 Thread samuraisam
Here, hopefully this can explain it better (a little more specific, but maybe that'll help): select all entries where: if the user is the owner or a writer of the blog, the private posts if the user is registered, the protected posts if the user is a member of the owne

Re: Filter QuerySet using Manager

2006-10-11 Thread samuraisam
The biggest reason I want to filter it here, in the Model level, is so I can still slice and chain filters, like normal QuerySets, and the permissions will be transparently taken care of. Thanks again, Sam --~--~-~--~~~---~--~~ You received this message because y