I have a webpage that displays data based on a default date. The user can then change their view of the data by slecting a date with a date picker and clicking a submit button. I already have a variable set so that if no date is chosen, a default date is used…. so what’s the problem? The problem comes if the user trys to type in the url page without a parameter… like so:
http://mywebpage/viewdata (example A)
instead of
http://mywebpage/viewdata?date= (example B)
I tried using:
if request.method == 'GET':
but apparently, even example A still returns true. I’m sure I’m doing some obvious beginner’s mistake but I’ll ask anyway… Is there a simpler way to handle example A other than passing the url to a string and checking the string for “?date=”?
I don’t really understand your question – some more code would have helped – but don’t you just need to do: