I am trying to develop some functionality so that a user is able to query by a color. I have a form drop-down menu where the user can select one color type to appear. They are also able to leave it blank so that it returns all the available colors. I have my form returning the right results when a color type is selected. However, I am having problems displaying the results when no color is selected (because I'm using a filter).
Here is part of my view if request['color'] == "---------------": # This means no color was selected mycolor = ColorCategory.objects.all() else: mycolor = request['color'] ... i = Choice.objects.get(id=h.id).style_set.filter(color_cat=mycolor) //////////////////// So, as you can probably see when a color type is selected then mycolor is set to request['color']. However, when a color is not selected then mycolor is set to 'ColorCategory.objects.all(). Then later in my view when I try to do a filter(color_cat=mycolor) It errors out because mycolor is equal to a list of ColorCategory objects. I need mycolor to equal any ColorCategory number. Does anybody know how to do that? Thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---