Thank you for the reply. I tried going the route of using the below. Is your way better? Since 'in' needs a list as an argument and SelectMultiple returns a list:
if request.method == "POST" or request.GET.get('page', ''): search_form = SearchForm(request.POST) if search_form.is_valid(): search_clean = search_form.cleaned_data results = Mls.objects.filter (county__in=search_clean['county'] On Dec 8, 2:33 am, krylatij <[EMAIL PROTECTED]> wrote: > > 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 -~----------~----~----~----~------~----~------~--~---