Hi Ross,
The empty Q is the same thing as nothing, no filter.
I need to filter the query according to the options the user checks on
the form.
So this line:
(form.data.get('my') and Q(friends_set=request.user.id) or Q())
means:
(if checkbox 'my' is checked filter using
(friends_set=request.user.id) or don't filter)
It seems complex at first, but is easier to deal with all options:
- 'my': Q(friends_set=request.user.id)
- 'who': Q(profile__friends=request.user.id)
- 'my' + 'who': Q(friends_set=request.user.id) |
Q(profile__friends=request.user.id)
I hope this helps...
Best regards,
Enrico
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---