refactor login view
[mygpo.git] / mygpo / web / urls.py
blob1a76a7892c647bb140530660bf46b48e4c433ca5
1 from django.conf.urls.defaults import *
2 from django.contrib.auth.views import logout
3 from django.views.generic.simple import direct_to_template
5 from django_couchdb_utils.registration.views import activate, register
6 from django_couchdb_utils.registration.forms import RegistrationFormUniqueEmail
8 from mygpo.web.logo import CoverArt
11 urlpatterns = patterns('mygpo.web.views',
12 url(r'^$', 'home', name='home'),
13 url(r'^logo/(?P<size>\d+)/(?P<prefix>.{3})/(?P<filename>[^/]*)$', CoverArt.as_view(), name='logo'),
14 url(r'^history/$', 'history', name='history'),
15 url(r'^suggestions/$', 'suggestions', name='suggestions'),
16 url(r'^suggestions/rate$', 'rate_suggestions', name='suggestions-rate'),
17 url(r'^suggestions/blacklist/(?P<slug_id>[\w-]+)$', 'blacklist', name='suggestions-blacklist-slug-id'),
18 url(r'^tags/', 'mytags', name='tags'),
19 url(r'^online-help', direct_to_template,
20 {'template': 'online-help.html'}, name='help'),
21 (r'^developer/', direct_to_template,
22 {'template': 'developer.html'}),
23 url(r'^contribute/', direct_to_template,
24 {'template': 'contribute.html'},
25 name='contribute'),
26 url(r'^privacy/', direct_to_template,
27 {'template': 'privacy_policy.html'}, name='privacy-policy'),
31 urlpatterns += patterns('mygpo.web.views.subscriptions',
32 url(r'^subscriptions/$', 'show_list', name='subscriptions'),
33 url(r'^download/subscriptions\.opml$', 'download_all', name='subscriptions-opml'),
34 url(r'^subscriptions/all.opml$', 'download_all', name='subscriptions-download'),
35 url(r'^user/(?P<username>[\w.-]+)/subscriptions$', 'for_user', name='shared-subscriptions'),
36 url(r'^user/(?P<username>[\w.-]+)/subscriptions\.opml$', 'for_user_opml', name='shared-subscriptions-opml'),
37 url(r'^user/(?P<username>[\w.-]+)/subscriptions/rss/$', 'subscriptions_feed', name='shared-subscriptions-rss'),
40 urlpatterns += patterns('mygpo.web.views.podcast',
41 url(r'^subscribe', 'subscribe_url', name='subscribe-by-url'),
43 url(r'^podcast/(?P<pid>\d+)$', 'show_oldid', name='podcast'),
44 url(r'^podcast/(?P<pid>\d+)/subscribe$', 'subscribe_oldid', name='subscribe'),
45 url(r'^podcast/(?P<pid>\d+)/unsubscribe/(?P<device_uid>[\w.-]+)', 'unsubscribe_oldid', name='unsubscribe'),
46 url(r'^podcast/(?P<pid>\d+)/add-tag', 'add_tag_oldid', name='add-tag'),
47 url(r'^podcast/(?P<pid>\d+)/remove-tag', 'remove_tag_oldid', name='remove-tag'),
48 url(r'^podcast/(?P<pid>\d+)/set-public', 'set_public_oldid', name='podcast-public', kwargs={'public': True}),
49 url(r'^podcast/(?P<pid>\d+)/set-private', 'set_public_oldid', name='podcast-private', kwargs={'public': False}),
50 url(r'^podcast/(?P<pid>\d+)/-episodes', 'all_episodes_oldid', name='podcast-all-episodes'),
51 url(r'^podcast/(?P<pid>\d+)/-flattr', 'flattr_podcast_oldid', name='podcast-flattr'),
53 url(r'^podcast/(?P<slug_id>[\w-]+)/?$', 'show_slug_id', name='podcast-slug-id'),
54 url(r'^podcast/(?P<slug_id>[\w-]+)/subscribe$', 'subscribe_slug_id', name='subscribe-slug-id'),
55 url(r'^podcast/(?P<slug_id>[\w-]+)/unsubscribe/(?P<device_uid>[\w.-]+)', 'unsubscribe_slug_id', name='unsubscribe-slug-id'),
56 url(r'^podcast/(?P<slug_id>[\w-]+)/add-tag', 'add_tag_slug_id', name='add-tag-slug-id'),
57 url(r'^podcast/(?P<slug_id>[\w-]+)/remove-tag', 'remove_tag_slug_id', name='remove-tag-slug-id'),
58 url(r'^podcast/(?P<slug_id>[\w-]+)/set-public', 'set_public_slug_id', name='podcast-public-slug-id', kwargs={'public': True}),
59 url(r'^podcast/(?P<slug_id>[\w-]+)/set-private', 'set_public_slug_id', name='podcast-private-slug-id', kwargs={'public': False}),
60 url(r'^podcast/(?P<slug_id>[\w-]+)/-episodes', 'all_episodes_slug_id', name='podcast-all-episodes-slug-id'),
61 url(r'^podcast/(?P<slug_id>[\w-]+)/-flattr', 'flattr_podcast_slug_id', name='podcast-flattr-slug-id'),
65 urlpatterns += patterns('mygpo.web.views.episode',
67 url(r'^favorites/$',
68 'list_favorites',
69 name='favorites'),
71 url(r'^episode/(?P<id>\d+)$', 'show_oldid', name='episode'),
72 url(r'^episode/(?P<id>\d+)/add-chapter$', 'add_chapter_oldid', name='add-chapter'),
73 url(r'^episode/(?P<id>\d+)/remove-chapter/(?P<start>\d+)-(?P<end>\d+)$', 'remove_chapter_oldid',name='remove-chapter'),
74 url(r'^episode/(?P<id>\d+)/toggle-favorite', 'toggle_favorite_oldid',name='episode-fav'),
75 url(r'^episode/(?P<id>\d+)/add-action', 'add_action_oldid', name='add-episode-action'),
76 url(r'^episode/(?P<id>\d+)/-flattr', 'flattr_episode_oldid', name='flattr-episode'),
78 url(r'^podcast/(?P<p_slug_id>[\w-]+)/(?P<e_slug_id>[\w-]+)$', 'show_slug_id', name='episode-slug-id'),
79 url(r'^episode/(?P<p_slug_id>[\w-]+)/(?P<e_slug_id>[\w-]+)/add-chapter$', 'add_chapter_slug_id', name='add-chapter-slug-id'),
80 url(r'^episode/(?P<p_slug_id>[\w-]+)/(?P<e_slug_id>[\w-]+)/remove-chapter/(?P<start>\d+)-(?P<end>\d+)$',
81 'remove_chapter', name='remove-chapter'),
82 url(r'^episode/(?P<p_slug_id>[\w-]+)/(?P<e_slug_id>[\w-]+)/toggle-favorite', 'toggle_favorite_slug_id', name='episode-fav-slug-id'),
83 url(r'^episode/(?P<p_slug_id>[\w-]+)/(?P<e_slug_id>[\w-]+)/add-action', 'add_action_slug_id', name='add-episode-action-slug-id'),
84 url(r'^podcast/(?P<p_slug_id>[\w-]+)/(?P<e_slug_id>[\w-]+)/-flattr', 'flattr_episode_slug_id', name='flattr-episode-slug-id'),
87 from mygpo.web.views.settings import DefaultPrivacySettings, \
88 PodcastPrivacySettings, ProfileView, FlattrSettingsView, \
89 FlattrTokenView, FlattrLogout
91 urlpatterns += patterns('mygpo.web.views.settings',
92 url(r'^account/$', 'account', name='account'),
93 url(r'^account/privacy$', 'privacy', name='privacy'),
95 url(r'^account/profile$',
96 ProfileView.as_view(),
97 name='profile'),
99 url(r'^account/flattr$',
100 FlattrSettingsView.as_view(),
101 name='flattr-settings'),
103 url(r'^account/flattr/token$',
104 FlattrTokenView.as_view(),
105 name='flattr-token'),
107 url(r'^account/flattr/logout$',
108 FlattrLogout.as_view(),
109 name='flattr-logout'),
111 url(r'^account/privacy/default-public$',
112 DefaultPrivacySettings.as_view(public=True),
113 name='privacy_default_public'),
115 url(r'^account/privacy/default-private$',
116 DefaultPrivacySettings.as_view(public=False),
117 name='privacy_default_private'),
119 url(r'^account/privacy/(?P<podcast_id>[\w]+)/public$',
120 PodcastPrivacySettings.as_view(public=True),
121 name='privacy_podcast_public'),
123 url(r'^account/privacy/(?P<podcast_id>[\w]+)/private$',
124 PodcastPrivacySettings.as_view(public=False),
125 name='privacy_podcast_private'),
127 url(r'^account/delete$', 'delete_account',name='delete-account'),
130 urlpatterns += patterns('mygpo.web.views.device',
131 url(r'^devices/$', 'overview', name='devices'),
132 url(r'^devices/create$', 'edit_new', name='device-edit-new'),
133 url(r'^devices/create-device$', 'create', name='device-create'),
134 url(r'^device/(?P<uid>[\w.-]+)\.opml$', 'opml', name='device-opml'),
135 url(r'^device/(?P<uid>[\w.-]+)$', 'show', name='device'),
136 url(r'^device/(?P<uid>[\w.-]+)/symbian.opml$', 'symbian_opml', name='device-symbian-opml'),
137 url(r'^device/(?P<uid>[\w.-]+)/sync$', 'sync', name='device-sync'),
138 url(r'^device/(?P<uid>[\w.-]+)/unsync$', 'unsync', name='device-unsync'),
139 url(r'^device/(?P<uid>[\w.-]+)/delete$', 'delete', name='device-delete'),
140 url(r'^device/(?P<uid>[\w.-]+)/remove$', 'delete_permanently', name='device-delete-permanently'),
141 url(r'^device/(?P<uid>[\w.-]+)/undelete$', 'undelete', name='device-undelete'),
142 url(r'^device/(?P<uid>[\w.-]+)/history$', 'history', name='device-history'),
143 url(r'^device/(?P<uid>[\w.-]+)/edit$', 'edit', name='device-edit'),
144 url(r'^device/(?P<uid>[\w.-]+)/update$', 'update', name='device-update'),
145 url(r'^device/(?P<uid>[\w.-]+)/upload-opml$', 'upload_opml', name='device-upload-opml'),
149 from mygpo.web.views.users import LoginView
151 urlpatterns += patterns('mygpo.web.views.users',
153 url(r'^login/$',
154 LoginView.as_view(),
155 name='login'),
157 url(r'^logout/$', logout, {'next_page': '/'}, name='logout'),
158 url(r'^register/resend-activation$', 'resend_activation', name='resend-activation'),
159 url(r'^register/restore_password$', 'restore_password', name='restore-password'),
160 url(r'^register/$', register,
161 {'backend': 'django_couchdb_utils.registration.backends.default.DefaultBackend',
162 'form_class': RegistrationFormUniqueEmail}, name='register'),
163 (r'^registration_complete/$', direct_to_template,
164 {'template': 'registration/registration_complete.html'}),
165 (r'^activate/(?P<activation_key>\w+)$', activate,
166 {'backend': 'django_couchdb_utils.registration.backends.default.DefaultBackend'}),