I am using django to build a login and logout page , below are my codes
urls.py
from django.conf.urls.defaults import *
from django.conf import settings
from django.core.urlresolvers import reverse
urlpatterns = patterns('',
url(r'^$', 'learn_django.views.home_page'),
url(r'^login/$', 'learn_django.views.login'),
url(r'^logout/$', 'django.contrib.auth.views.logout', {'template_name': 'logout.html'}),
)
views.py
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.contrib.auth import authenticate, login as main_login, logout as main_logout
def home_page(request):
return render_to_response("home_page.html")
def login(request):
.....
.....
return render_to_response("login.html")
logout.html
{% extends 'base.html' %}
{% block title %}Logout Page{% endblock %}
{% block body %}
<div>
<p style='color:#092E20;font-size:25px;font-weight:bold;padding-top:20px;padding-left:15px;'>
You have been successfully logged out......
</p>
<p>Redirecting to login page.....</p>
</div>
{% endblock %}
So in the above codes, i will have a login url which will display a login form and redirects to another url after successfull login which is working fine
Also i will have a logout url for which i am using the django built-in logout view
, by supplying it a template logout.html
which is also working fine and displaying the above html code successfully when i clicked the logout url
So now i want to redirect to the login page after displaying the logout page(after some time period....). I mean first the logout view should render the logout.html
code and next should redirect to login page ....
Can anyone please let me know how to redirect to login html page after rendering logout.html as above ......