diff options
author | Weitian LI <liweitianux@gmail.com> | 2014-04-20 17:01:59 +0800 |
---|---|---|
committer | Weitian LI <liweitianux@gmail.com> | 2014-04-20 17:01:59 +0800 |
commit | 5bd3311371eddda6952ea85b41c6f59d36d7dd3b (patch) | |
tree | b4fddb6f39564003b3948cbdad98281c69e392c7 /account | |
parent | 733a218f0c807dd6c6c60addca1cb3c512207993 (diff) | |
download | django-skaschool-5bd3311371eddda6952ea85b41c6f59d36d7dd3b.tar.bz2 |
* 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
Diffstat (limited to 'account')
-rw-r--r-- | account/templates/account/login.html | 24 | ||||
-rw-r--r-- | account/templates/account/logout.html | 19 | ||||
-rw-r--r-- | account/templates/account/profile.html | 21 | ||||
-rw-r--r-- | account/urls.py | 17 |
4 files changed, 78 insertions, 3 deletions
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 %} + <div class="container"> + <h2>登录</h2> + <br /> + <form role="form" class="form-horizontal" method="post"> + {% csrf_token %} + {% bootstrap_form form layout='horizontal' %} + {% buttons submit='提交' reset='取消' layout='horizontal' %}{% endbuttons %} + </form> + </div> +{% 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 %} + <div class="container"> + <h2>已退出</h2> + <p class="lead">您已成功退出。</p> + </div> +{% 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 %} + <div class="container"> + <h2>个人主页</h2> + <p class="lead">TODO ...</p> + + <br /> + </div> +{% 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<activation_key>\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'), ) |