Reputation: 5253
I am using Django-Python for my project..I have created a "Master HTML page" and all other pages extends this master page..
There is a Drop down (Select Menu) in Master page..and i want to access the value of selected option across all Django Function and views..
How can i achieve that..??
Upvotes: 2
Views: 557
Reputation: 46
The solution would be to assign the value of the select menu's selected value to a session variable via post (a jQuery ajax post may be less obtrusive).
Somewhere in your view:
if request.POST:
request.SESSION['select_menu_value'] = request.POST.get('select_menu_value')
Upvotes: 2
Reputation: 49816
Well, presumably you are dealing with form posts whenever you want to access the option you refer to.
You could either have your whole page be contained by a form, or use javascript to set a hidden field within your main form which is submitted.
You can then access it as a raw property of the POST object, or bind a Form object to handle it.
Upvotes: 0