yourmodel.objects.filter(a) does not work since a seems to be a queryset.

You need to use .filter(attribute=value) or something like this.

BTW: Why do you do all the select_related() calls?

Michael schrieb:
> Hello,
> Here is my code:
>
> filter = {}
> if request.GET.get('color', '').isdigit():
>         filter['color_cat'] = request.GET['color']
> if request.GET.get('origin', '').isdigit():
>         filter['collection__origin'] = request.GET['origin']
> styles = Style.objects.select_related().filter(**filter).distinct()
> if request.GET.get('minprice', '').isdigit() :
>         if request.GET.get('size', '').isdigit():
>             a = Style.objects.filter(Q
> (sandp__size__size_cat=request.GET['size']) & Q
> (sandp__price__name__gte=request.GET['minprice']))
>             styles = styles.select_related().filter(a) ### This is the
> line that is giving me the error!!
>
> Whenever I do a search where the user enters a minimum price and
> selects a size....I get the error:
>
> 'ValueError at /search/ too many values to unpack'
>
> The error comes from the line 'styles = styles.select_related().filter
> (a)'
>   


-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de


--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to