diff options
author | substantialnoninfringinguser <substantialnoninfringinguser@gmail.com> | 2009-05-13 05:48:10 +0100 |
---|---|---|
committer | substantialnoninfringinguser <substantialnoninfringinguser@gmail.com> | 2009-05-13 05:48:10 +0100 |
commit | ed345f25760d8927f834a69202c2b9b2cef71ee0 (patch) | |
tree | 652dba01640060cc2106af850955728828bcd8f0 /registration/urls.py | |
parent | cdd4e685ee95e44b9a599b03cf11723a4ce7b7c6 (diff) | |
download | troggle-ed345f25760d8927f834a69202c2b9b2cef71ee0.tar.gz troggle-ed345f25760d8927f834a69202c2b9b2cef71ee0.tar.bz2 troggle-ed345f25760d8927f834a69202c2b9b2cef71ee0.zip |
[svn] Add user registration and user profiles.
Used modified versions of django-registration and django-profiles , both on bitbucket.
The Person model is now set up as the profile for auth.User s.
I set up a requestcontext so that settings is automatically passed to every template, no need to repeat ourselves in views. However, this needs to be refined: I will soon change it to only pass a subset of settings. E.G. we do not need to be passing the DB login and password!
Copied from http://cucc@cucc.survex.com/svn/trunk/expoweb/troggle/, rev. 8231 by aaron @ 1/29/2009 11:02 PM
Diffstat (limited to 'registration/urls.py')
-rw-r--r-- | registration/urls.py | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/registration/urls.py b/registration/urls.py new file mode 100644 index 0000000..25cf2b0 --- /dev/null +++ b/registration/urls.py @@ -0,0 +1,72 @@ +""" +URLConf for Django user registration and authentication. + +If the default behavior of the registration views is acceptable to +you, simply use a line like this in your root URLConf to set up the +default URLs for registration:: + + (r'^accounts/', include('registration.urls')), + +This will also automatically set up the views in +``django.contrib.auth`` at sensible default locations. + +But if you'd like to customize the behavior (e.g., by passing extra +arguments to the various views) or split up the URLs, feel free to set +up your own URL patterns for these views instead. If you do, it's a +good idea to use the names ``registration_activate``, +``registration_complete`` and ``registration_register`` for the +various steps of the user-signup process. + +""" + +from django.conf import settings +from django.conf.urls.defaults import * +from django.views.generic.simple import direct_to_template +from django.contrib.auth import views as auth_views + +from registration.views import activate +from registration.views import register + + +urlpatterns = patterns('', + # 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 + # confusing 404. + url(r'^activate/(?P<activation_key>\w+)/$', + activate, + name='registration_activate'), + url(r'^login/$', + auth_views.login, + {'template_name': 'registration/login.html'}, + name='auth_login'), + url(r'^logout/$', + auth_views.logout, + {'template_name': 'registration/logout.html'}, + name='auth_logout'), + url(r'^password/change/$', + auth_views.password_change, + name='auth_password_change'), + url(r'^password/change/done/$', + auth_views.password_change_done, + name='auth_password_change_done'), + url(r'^password/reset/$', + auth_views.password_reset, + name='auth_password_reset'), + url(r'^password/reset/confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', + auth_views.password_reset_confirm, + name='auth_password_reset_confirm'), + url(r'^password/reset/complete/$', + auth_views.password_reset_complete, + name='auth_password_reset_complete'), + url(r'^password/reset/done/$', + auth_views.password_reset_done, + name='auth_password_reset_done'), + url(r'^register/$', + register, + name='registration_register'), + url(r'^register/complete/$', + direct_to_template, + {'template': 'registration/registration_complete.html','extra_context':{'settings':settings}}, + name='registration_complete'), + ) |