How can I set default values in django for HttpRequest.GET?
I have a web page that displays data based on a default date. The user can then change their data view by selecting a date using a date picker and clicking the submit button. I already have a set of variables, so if no date is selected, the default date is used .... so what's the problem? The problem occurs if the user tries to enter the url page without a parameter ... for example:
http://mywebpage/viewdata (example A)
instead
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 have some obvious beginner error, but I'll ask anyway ... Is there an easier way to handle Example A other than passing the url string and checking the string for "? Date ="?
+2
a source to share
3 answers
http://docs.djangoproject.com/en/dev/ref/request-response/
Sounds like you are interested in POST
0
a source to share