javascript - configuring django urls and template -


i have django app have load same page twice different content. have login page , forcing user log out if login different machine. logged out , redirected login page time login page should have message " have been logged out because ...". on javascript authentication function have :

window.location = /login/?auth =false 

for redirection . redirect user login page , arguments @ url.

i using django.contrib.auth login mechanism. want know changes have make in urls.py , login template make work.

if adding parameter need no changes in url config, need take parameter account in view, following example assuming using function based views:

def my_view(request):   if request.get.get('auth'):     alt_login = true   else:     alt_login = false   context = {'alt_login': alt_login}   return render(request, 'template_path.html', context) 

in template can put following around optional block:

{% if alt_login %}   have been logged out because... {% endif %} 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -