Tim, Why do I need to do the following: if ('price' in request.POST) and (request.POST['price'] <> NOT_PICKED):
instead of if request.POST['price'] <> NOT_PICKED: //////////// Everytime the form is submitted a value for price is sent to the view. If no price was selected then the value of request.POST['price'] is equal to '-----------------'. So price will always be submitted. Thanks On Aug 8, 5:23 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > Thanks for the reply. Very helpful. In the past I did try the > > statement: > > > if 'price' in request and request['price'] <> NOT_PICKED: > > > //////////// > > > However when that line was accessed I would get the following error: > > > KeyError at /rugs/searchresult/ > > '0 not found in either POST or GET' > > > ///////////// > > > I think it has something to do with 'request'. Because when I take > > that out and just use 'if 'price' in request['price'] <> NOT_PICKED: ' > > then it doesn't error out. > > > Any suggestions as to why that's happening? > > Um...because it does nothing like what you expect it to? :) > > I'd try the earlier suggestion of > > if ('price' in request.GET) and \ > (request.GET['price'] <> NOT_PICKED): > > where GET can be converted to POST corresponding to whichever > method the form is using to send the filter criteria. (Parens > added around the two "and"ed clauses for clarity, though they > shouldn't make a difference). If the "in" returns true, the > second clause should not fail. > > -tim --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---