annotate accounts/urls.py @ 629:f4c043cf55ac

Wiki integration. Requests don't always have sessions. In particular this occurs when a request is made without a trailing slash. The Common middleware redirects when this happens, and the middleware process_request() processing stops before a session can get added. So just set an attribute on the request object for each operation. This seemed weird to me at first, but there are plenty of examples of this in the Django code base already.
author Brian Neal <bgneal@gmail.com>
date Tue, 13 Nov 2012 13:50:06 -0600
parents ee87ea74d46b
children 8e6b8ffe5f34
rev   line source
gremmie@1 1 """urls for the accounts application"""
bgneal@574 2 from django.conf.urls import patterns, url
bgneal@76 3 from django.conf import settings
gremmie@1 4
gremmie@1 5 urlpatterns = patterns('accounts.views',
bgneal@500 6 url(r'^login/ajax/$', 'login_ajax', name='accounts-login_ajax'),
gremmie@1 7 url(r'^register/$', 'register', name='accounts-register'),
gremmie@1 8 (r'^register/thanks/$', 'register_thanks'),
bgneal@289 9 (r'^register/confirm/(?P<username>[\w.@+-]{1,30})/(?P<key>[a-zA-Z0-9]{20})/$', 'register_confirm'),
gremmie@1 10 )
gremmie@1 11
gremmie@1 12 urlpatterns += patterns('',
bgneal@78 13 url(r'^login/$',
gremmie@1 14 'django.contrib.auth.views.login',
gremmie@1 15 kwargs={'template_name': 'accounts/login.html'},
gremmie@1 16 name='accounts-login'),
bgneal@78 17 url(r'^logout/$',
gremmie@1 18 'django.contrib.auth.views.logout',
gremmie@1 19 kwargs={'template_name': 'accounts/logout.html'},
bgneal@289 20 name='accounts-logout'),
bgneal@289 21 (r'^password/$',
bgneal@289 22 'django.contrib.auth.views.password_change',
gremmie@1 23 {'template_name': 'accounts/password_change.html',
bgneal@76 24 'post_change_redirect': settings.LOGIN_REDIRECT_URL}),
bgneal@289 25 url(r'^password/reset/$',
bgneal@289 26 'django.contrib.auth.views.password_reset',
bgneal@78 27 kwargs={'template_name': 'accounts/password_reset.html',
bgneal@78 28 'email_template_name': 'accounts/password_reset_email.txt',
bgneal@78 29 'post_reset_redirect': '/accounts/password/reset/sent/'},
bgneal@78 30 name='accounts-password_reset'),
bgneal@78 31 url(r'^password/reset/sent/$',
bgneal@78 32 'django.contrib.auth.views.password_reset_done',
bgneal@78 33 kwargs={'template_name': 'accounts/password_reset_sent.html'},
bgneal@78 34 name='accounts-password_reset_sent'),
bgneal@78 35 url(r'^password/reset/confirm/(?P<uidb36>[0-9a-z]+)/(?P<token>[0-9a-z]+-\w+)/$',
bgneal@78 36 'django.contrib.auth.views.password_reset_confirm',
bgneal@78 37 kwargs={
bgneal@78 38 'template_name': 'accounts/password_reset_confirm.html',
bgneal@78 39 'post_reset_redirect': '/accounts/password/reset/success/',
bgneal@78 40 },
bgneal@78 41 name='accounts-password_reset_confirm'),
bgneal@78 42 url(r'^password/reset/success/$',
bgneal@78 43 'django.contrib.auth.views.password_reset_complete',
bgneal@78 44 kwargs={'template_name': 'accounts/password_reset_complete.html'},
bgneal@78 45 name='accounts-password_reset_success'),
gremmie@1 46 )
gremmie@1 47