Advertisement
Guest User

external_apps/registration/urls.py

a guest
Aug 20th, 2010
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.84 KB | None | 0 0
  1. """
  2. URLConf for Django user registration and authentication.
  3.  
  4. If the default behavior of the registration views is acceptable to
  5. you, simply use a line like this in your root URLConf to set up the
  6. default URLs for registration::
  7.  
  8.    (r'^accounts/', include('registration.urls')),
  9.  
  10. This will also automatically set up the views in
  11. ``django.contrib.auth`` at sensible default locations.
  12.  
  13. But if you'd like to customize the behavior (e.g., by passing extra
  14. arguments to the various views) or split up the URLs, feel free to set
  15. up your own URL patterns for these views instead. If you do, it's a
  16. good idea to use the names ``registration_activate``,
  17. ``registration_complete`` and ``registration_register`` for the
  18. various steps of the user-signup process.
  19.  
  20. """
  21.  
  22.  
  23. from django.conf.urls.defaults import *
  24. from django.views.generic.simple import direct_to_template
  25. from django.contrib.auth import views as auth_views
  26. from django.conf import settings
  27.  
  28. from registration.views import activate
  29. from registration.views import register
  30.  
  31.  
  32. urlpatterns = patterns('',
  33.                        # Activation keys get matched by \w+ instead of the more specific
  34.                        # [a-fA-F0-9]{40} because a bad activation key should still get to the view;
  35.                        # that way it can return a sensible "invalid key" message instead of a
  36.                        # confusing 404.
  37.                        url(r'^activate/(?P<activation_key>\w+)/$',
  38.                            activate,
  39.                            name='registration_activate'),
  40.                        url(r'^login/$',
  41.                            auth_views.login,
  42.                            {'template_name': 'registration/login.html'},
  43.                            name='auth_login'),
  44.                        url(r'^logout/$',
  45.                            auth_views.logout,
  46.                            {'template_name': 'registration/logout.html'},
  47.                            name='auth_logout'),
  48.                        url(r'^password/change/$',
  49.                            auth_views.password_change,
  50.                            name='auth_password_change'),
  51.                        url(r'^password/change/done/$',
  52.                            auth_views.password_change_done,
  53.                            name='auth_password_change_done'),
  54.                        url(r'^password/reset/confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
  55.                            auth_views.password_reset_confirm,
  56.                            name='auth_password_reset_confirm'),
  57.                        url(r'^password/reset/complete/$',
  58.                            auth_views.password_reset_complete,
  59.                            name='auth_password_reset_complete'),
  60.                        url(r'^password/reset/done/$',
  61.                            auth_views.password_reset_done,
  62.                            name='auth_password_reset_done'),
  63.                        url(r'^register/$',
  64.                            register,
  65.                            name='registration_register'),
  66.                        url(r'^register/complete/$',
  67.                            direct_to_template,
  68.                            {'template': 'registration/registration_complete.html'},
  69.                            name='registration_complete'),
  70.                        )
  71.  
  72. if settings.EMAIL_SEND_HTML:
  73.     urlpatterns += patterns('',
  74.                        url(r'^password/reset/$',
  75.                            auth_views.password_reset,
  76.                            {'email_template_name': 'registration/password_reset_HTMLemail.html'},
  77.                            name='auth_password_reset'),
  78.                         )
  79. else:
  80.     urlpatterns += patterns('',
  81.                        url(r'^password/reset/$',
  82.                             auth_views.password_reset,
  83.                             name='auth_password_reset'),
  84.                        )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement