Hello, I have a radio button in template for a search "AND" or "OR" selection, with the name andor1 values 1 (or) and 2 (and) <input type="radio" name="andor1" value=1 checked> <input type="radio" name="andor1" value=2>
In the views.py: def Bypub(request): andor1 = request.POST['andor1'] list=[] andlist=[] for publication in pub1: if andor1 == 1: # this assignment is being ignored. if publication not in list: list.append(publication) if andor1 == 2: # this assignment is being ignored. if publication in list: andlist.append(publication) return render_to_response('search/categories.html', { 'andor1' : andor1, 'andor2' : andor2, 'andor3' : andor3, 'list' : list, 'andlist' : andlist, }, context_instance=RequestContext(request) ) I receive no errors, however, the list.append has no publications. I get publications, if I remove the if andor1 ==1 assignment, but I need to make a logical filter based on whether the user chooses "AND" or "OR" in the search criteria. When I send andor back to the template the value andor = 1 or 2 appears, so it is being captured, but I'm not getting the assignment correct in the function. Any suggestions? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---