Created
August 19, 2014 05:44
-
-
Save hitsujixgit/1d65803abbd7a4289fc4 to your computer and use it in GitHub Desktop.
Implemented logout function.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends "base.html" %} | |
{% block title_html %} | |
Django Test Page | |
{% endblock %} | |
{% block h1 %} | |
Hello world | |
{% endblock %} | |
{% block article_content %} | |
<p>Welcome to Django world!</p> | |
<p><a href="login">Your Account</a></p> | |
<p><a href="logout">Logout</a></p> | |
{% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends "base.html" %} | |
{% block title_html %} | |
Logout | |
{% endblock %} | |
{% block h1 %} | |
Logout successful. | |
{% endblock %} | |
{% block article_content %} | |
<p><a href="/">Return to home</a></p> | |
{% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- Coding: utf-8 -*- | |
from django.shortcuts import render | |
from django.contrib.auth import logout | |
def page(request): | |
logout(request) | |
return render(request, 'jp/logout.html') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
urlpatterns = patterns('', | |
url(r'^logout/$', 'myapp.views.logout.page', name="user_logout"), | |
#...other urls. | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment