python - CSRF verification error on GET form method -
i getting error csrf verification failed. request aborted.
when trying submit form. have used method, yet getting error. have added {% csrf_token %} token also, sure, error still there.
sample html:
<body> <form action="/entry/" method="get" name="form1"><br> {% csrf_token %} <select name="date" size="1"> <option>30</option> </select> <select name="month"> <option>09</option> </select> <select name="year"> <option>2015</option> </select> <input id="save" style="height: 50px; width: 100px;" type="submit" value="save"></form> </body>
views.py file
def getuser(request): return render(request, 'index.html') def putrecord(request): date = request.get['date'] print date month = request.get['month'] year = request.get['year'] time_stamp = date + '/' + month + '/' + year print time_stamp return render(request, 'index.html', {})
urls.py
urlpatterns = patterns('', url(r'^expenseapp/', getuser), url(r'^entry/', putrecord), )
i have csrfviewmiddleware
in settings file. how can rid of error?
try delete cookies browser, csrf use cookie store token.
Comments
Post a Comment