I have a card store and I would like to add 3 options a user can
search by. Year, Brand, and Card Title

Normally this would be easy but my dilemna here is:
- All of these are optional, and if they do not search for a certain
one, the query should ignore that filter entirely and display in full
(So if none of the filters are active I display ALL cards)

So basically what I am thinking of was:

if request.POST.get('brand'):
Q(brand=request.POST.get('brand')

if request.POST.get('year'):
Q(year=request.POST.get('year')

etc.

cards = Card.objects.filter(... Now how do I get those Q objects into
here ??).order_by('pk')

So basically, I understand the concept but just not sure on the syntax
here and after some looking around no luck.

Thanks in advance for your help.
--~--~---------~--~----~------------~-------~--~----~
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