Should this code not be working?
if request.GET.has_key("category"):
try:
post_list = post_list.filter(category=request.GET.get("category"))
except ValueError:
print "Category is not an integer"
Category is an IntegerField. I'm trying to handle the case when a user enters the URL http://myurl.com?category= where category has no value.
Thanks for your help!
ifindentation and the code inside it, it's correct on my IDE. SO doesn't like to paste indentations correctly...