Hi People,

I'm trying to write a query using Q objects but I'm getting incredibly
frustrated with them. I'm afraid I don't know SQL so I wouldn't know
how to write the queries by hand! The query (using Q objects) I am
trying to construct is:-

media = media.filter(
    Q(owner=requester) |
    Q(user_permission__granted_to=requester,
user_permission__privilege__icontains=privilege) |
    Q(group_permission__granted_to__members=requester,
group_permission__privilege__icontains=privilege) |
    Q(tags__user_permission__granted_to=requester,
tags__user_permission__privilege__icontains=privilege) |
    Q(tags__group_permission__granted_to__members=requester,
tags__group_permission__privilege__icontains=privilege)
)

I think most people would be able to figure out what I wanted there!
The SQL this generates can be seen at http://dpaste.com/34377/ if this
helps anyone. I'm running out of ideas of what to try next.

Can anyone help me? Is there another way I could go about this?

Any help would be appreciated immensely,
Oliver
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to