> I am working on a search form that has a SelectMultiple widget. What
> would be the best way to make a complex lookup with the SelectMultiple
> widget?
try this:
....
try:
    district_ids = [int(x) for x in request.GET.getlist('district')]
    if len(district_ids) == 0:
        district_ids = [-1, ]
except KeyError, ValueError:
        district_ids = [-1,]
...
if -1 not in district_ids:
    # search by district
    return MyModel.objects.filter(district__in = district_ids)



--~--~---------~--~----~------------~-------~--~----~
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