From 5bd3311371eddda6952ea85b41c6f59d36d7dd3b Mon Sep 17 00:00:00 2001 From: Weitian LI Date: Sun, 20 Apr 2014 17:01:59 +0800 Subject: * updated django_skaschool/settings.py o LOGIN_URL, LOGIN_REDIRECT_URL, LOGOUT_URL * added login/logout views to account urls.py * added account templates for login, logout, profile --- account/templates/account/login.html | 24 ++++++++++++++++++++++++ account/templates/account/logout.html | 19 +++++++++++++++++++ account/templates/account/profile.html | 21 +++++++++++++++++++++ account/urls.py | 17 ++++++++++++++--- 4 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 account/templates/account/login.html create mode 100644 account/templates/account/logout.html create mode 100644 account/templates/account/profile.html (limited to 'account') diff --git a/account/templates/account/login.html b/account/templates/account/login.html new file mode 100644 index 0000000..b41844e --- /dev/null +++ b/account/templates/account/login.html @@ -0,0 +1,24 @@ +{% extends 'base.html' %} +{% load staticfiles %} +{% load url from future %} +{% load bootstrap3 %} + +{# login template #} + +{% block title %} +登录 | 2014 SKA Summer School +{% endblock %} + +{% block content %} +
+

登录

+
+
+ {% csrf_token %} + {% bootstrap_form form layout='horizontal' %} + {% buttons submit='提交' reset='取消' layout='horizontal' %}{% endbuttons %} +
+
+{% endblock %} + +{# vim: set ts=8 sw=2 tw=0 fenc=utf-8 ft=htmldjango.html: #} diff --git a/account/templates/account/logout.html b/account/templates/account/logout.html new file mode 100644 index 0000000..7e3ac4a --- /dev/null +++ b/account/templates/account/logout.html @@ -0,0 +1,19 @@ +{% extends 'base.html' %} +{% load staticfiles %} +{% load url from future %} +{% load bootstrap3 %} + +{# login template #} + +{% block title %} +已退出 | 2014 SKA Summer School +{% endblock %} + +{% block content %} +
+

已退出

+

您已成功退出。

+
+{% endblock %} + +{# vim: set ts=8 sw=2 tw=0 fenc=utf-8 ft=htmldjango.html: #} diff --git a/account/templates/account/profile.html b/account/templates/account/profile.html new file mode 100644 index 0000000..aac992f --- /dev/null +++ b/account/templates/account/profile.html @@ -0,0 +1,21 @@ +{% extends 'base.html' %} +{% load staticfiles %} +{% load url from future %} +{% load bootstrap3 %} + +{# login template #} + +{% block title %} +个人主页 | 2014 SKA Summer School +{% endblock %} + +{% block content %} +
+

个人主页

+

TODO ...

+ +
+
+{% endblock %} + +{# vim: set ts=8 sw=2 tw=0 fenc=utf-8 ft=htmldjango.html: #} diff --git a/account/urls.py b/account/urls.py index 3ae8d12..c73d59c 100644 --- a/account/urls.py +++ b/account/urls.py @@ -32,7 +32,7 @@ urlpatterns = patterns('', url(r'^activate/complete/$', TemplateView.as_view(template_name='registration/activation_complete.html'), name='registration_activation_complete'), - # 3. registration_activate + # 3. registration_activate (place this section *AFTER* step 4) # Activation keys get matched by \w+ instead of the more specific # [a-fA-F0-9]{40} because a bad activation key should still get to the view; # that way it can return a sensible "invalid key" message instead of a @@ -40,8 +40,19 @@ urlpatterns = patterns('', url(r'^activate/(?P\w+)/$', ActivationView.as_view(), name='registration_activate'), - ## django auth - #(r'', include('registration.auth_urls')), + ## django auth views + # login + url(r'^login/$', 'django.contrib.auth.views.login', + {'template_name': 'account/login.html'}, + name='login'), + # logout + url(r'^logout/$', 'django.contrib.auth.views.logout', + {'template_name': 'account/logout.html'}, + name='logout'), + # profile + url(r'^profile/$', + TemplateView.as_view(template_name='account/profile.html'), + name='profile'), ) -- cgit v1.2.2