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

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -