I want to access post method data in views.py. I am following procedure of using pure html for form not Django form class. I tried the solution MultiValueDictKeyError in Django but still it is not working. Help me out
index.html
<form action="{% url "Sample:print" %}" method="post">
{% csrf_token %}
<input type="text" placeholder="enter anything" id="TB_sample"/><br>
<input type="submit" value="submit">
</form>
views.py
def print(request):
value=request.POST['TB_sample']
# value = request.REQUEST.get(request,'TB_sample')
# value = request.POST.get('TB_sample','')
print(value)
return render(request , 'static/Sample/print.html',{"data":"I want to pass here 'Value'"})
I tried all commented types. still i get the many errors . None of these solutions working.