How to get input field value without using form in Python -
i need 1 help. need fetch input field value using python , field not inside form using name/id
attribute. explaining code below.
home.html:
{% extends 'base.html' %} {% block content %} <center><h1>welcome</h1></center> <input type="hidden" name="id" value="{{sid}}"> {% endblock %}
views.py:
def home(request): """ function provides home page .""" pers = user.objects.get(pk=request.session['id']) user_name = pers.uname return render(request, 'bookingservice/home.html', {'username': user_name, 'count': 1,'sid':request.session['sid']})
here need hidden field value compare request.session['sid']
within if statement
. please me.
try this
pers = user.objects.get(pk=request.post.get("id"))
may you
Comments
Post a Comment