Merge branch 'master' into test
[auf_savoirs_en_partage_django.git] / auf_savoirs_en_partage / urls.py
CommitLineData
f8c16b3d 1# -*- encoding: utf-8 -*-
bae03b7b 2
155a7c62 3from django.conf import settings
31249cf3
EMS
4from django.conf.urls import patterns, include, url
5from django.conf.urls.static import static
155a7c62 6from django.contrib import admin
31249cf3
EMS
7from django.views.generic import TemplateView
8
9from savoirs.rss import \
10 FilChercheurs, FilRessources, FilActualites, \
11 FilAppels, FilEvenements, FilSites, FilMessages
31249cf3 12
ff752682
PP
13from chercheurs.forms import ReactiverForm
14
9f43a123
PP
15from sitemaps import sitemaps
16
17from views import RobotsTxtView
18
ff752682 19
155a7c62
CR
20admin.autodiscover()
21
1e28a70a 22handler500 = "views.page_500"
23handler404 = "views.page_404"
155a7c62 24
bae03b7b
EMS
25# Les URLs suivantes peuvent être préfixées de la discipline et/ou la
26# région. Nous les regroupons donc dans un module qu'on incluera plus bas.
31249cf3 27sep_patterns = patterns(
155a7c62 28 '',
713e8613 29
bae03b7b 30 # accueil
31249cf3 31 url(r'^$', 'savoirs.views.index', name='accueil'),
f24e513e 32
f8c16b3d 33 # recherche
31249cf3 34 url(r'^recherche/$', 'savoirs.views.recherche'),
f0692c02
EMS
35)
36
37urlpatterns = sep_patterns + patterns(
38 '',
39
31249cf3 40 url(r'^informations/$', 'savoirs.views.informations'),
f0692c02
EMS
41
42 # agenda
31249cf3 43 url(r'^agenda/$', 'savoirs.views.evenement_index', name='agenda'),
14631c92 44 url(r'^agenda/evenements/(?P<id>\d+)/(?P<slug>[\w\d\-\_\.]+)$', 'savoirs.views.evenement',
31249cf3 45 name='evenement'),
14631c92
PP
46 url(r'^agenda/evenements/(?P<id>\d+)/$', 'savoirs.views.evenement',
47 name='evenement-canonical'),
31249cf3
EMS
48 url(r'^agenda/evenements/moderer/$', 'savoirs.views.evenement_moderation'),
49 url(r'^agenda/evenements/moderer/(.+)/accepter/$',
50 'savoirs.views.evenement_accepter'),
51 url(r'^agenda/evenements/moderer/(.+)/refuser/$',
52 'savoirs.views.evenement_refuser'),
53 url(r'^agenda/evenements/utilisation/$', 'savoirs.views.page_statique',
54 kwargs={'id': 'conditions-agenda'}, name='conditions-agenda'),
55 url(r'^agenda/evenements/creer/$', 'savoirs.views.evenement_ajout',
56 name='evenement-ajout'),
57 url(r'^agenda/evenements/creer/options_fuseau_horaire/$',
58 'savoirs.views.options_fuseau_horaire'),
f0692c02
EMS
59
60 # sous-menu droite
31249cf3
EMS
61 url(r'^a-propos/$', 'savoirs.views.page_statique',
62 kwargs={'id': 'a-propos'}, name='a-propos'),
63 url(r'^aide/$', 'savoirs.views.page_statique',
64 kwargs={'id': 'aide'}, name='aide'),
65 url(r'^domaines-de-recherche/$', 'savoirs.views.page_statique',
66 kwargs={'id': 'domaines-de-recherche'}, name='domaines-de-recherche'),
67 url(r'^legal/$', 'savoirs.views.page_statique',
68 kwargs={'id': 'legal'}, name='legal'),
69 url(r'^nous-contacter/$', 'savoirs.views.page_statique',
70 kwargs={'id': 'contact'}, name='contact'),
c1b134f8 71
f8c16b3d 72 # ressources
31249cf3 73 url(r'^ressources/$', 'savoirs.views.ressource_index', name='ressources'),
14631c92 74 url(r'^ressources/(?P<id>\d+)/(?P<slug>[\w\d\-\_\.]+)$', 'savoirs.views.ressource_retrieve',
31249cf3 75 name='ressource'),
14631c92
PP
76 url(r'^ressources/(?P<id>\d+)/$', 'savoirs.views.ressource_retrieve',
77 name='ressource-canonical'),
f0692c02 78
f8c16b3d 79 # actualités
31249cf3 80 url(r'^actualites/$', 'savoirs.views.actualite_index', name='actualites'),
14631c92 81 url(r'^actualites/(?P<id>\d+)/(?P<slug>[\w\d\-\_\.]+)$', 'savoirs.views.actualite',
31249cf3 82 name='actualite'),
14631c92
PP
83 url(r'^actualites/(?P<id>\d+)/$', 'savoirs.views.actualite',
84 name='actualite-canonical'),
31249cf3
EMS
85 url(r'^appels/$', 'savoirs.views.actualite_index',
86 kwargs={'type': 'appels'}, name='appels'),
c1b134f8 87
f0692c02 88 # sites
31249cf3
EMS
89 url(r'^sites/$', 'sitotheque.views.index', name='sites'),
90 url(r'^sites/(?P<id>\d+)/$', 'sitotheque.views.retrieve', name='site'),
91 url(r'^sites/google.xml$', 'sitotheque.views.config_google'),
f0692c02
EMS
92
93 # sites AUF
31249cf3 94 url(r'^sites-auf/$', 'savoirs.views.sites_auf', name='sites-auf'),
f8c16b3d 95
96 # chercheurs
31249cf3 97 url(r'^chercheurs/$', 'chercheurs.views.index', name='chercheurs'),
14631c92 98 url(r'^chercheurs/(?P<id>\d+)/(?P<slug>[\w\d\-\_\.]+)$', 'chercheurs.views.retrieve',
31249cf3 99 name='chercheur'),
14631c92
PP
100 url(r'^chercheurs/(?P<id>\d+)/$', 'chercheurs.views.retrieve',
101 name='chercheur-canonical'),
31249cf3
EMS
102 url(r'^chercheurs/inscription/$', 'chercheurs.views.inscription',
103 name='inscription'),
104 url(r'^chercheurs/inscription_faite/$',
105 TemplateView.as_view(
106 template_name='chercheurs/inscription_faite.html'
107 ),
108 name='chercheurs-inscription-faite'),
109 url(r'^chercheurs/activation/(?P<id_base36>.*)/(?P<token>.*)/$',
110 'chercheurs.views.activation',
111 name='chercheurs-activation'),
112 url(r'^chercheurs/desinscription/$', 'chercheurs.views.desinscription'),
113 url(r'^chercheurs/perso/$', 'chercheurs.views.perso'),
114 url(r'^chercheurs/edit/$', 'chercheurs.views.edit'),
115 url(r'^chercheurs/conversion$', 'savoirs.views.page_statique',
116 kwargs={'id': 'table-de-passage'}, name='conversion'),
ff752682 117
31249cf3
EMS
118 url(r'^chercheurs/connexion/$', 'chercheurs.views.login',
119 kwargs={'template_name': 'chercheurs/login.html'},
120 name='chercheurs-login'),
121 url(r'^chercheurs/deconnexion/$', 'django.contrib.auth.views.logout',
122 kwargs={'template_name': 'chercheurs/logged_out.html'},
123 name='chercheurs-logout'),
ff752682 124
31249cf3
EMS
125 url(r'^chercheurs/changement-mdp/$', 'chercheurs.views.password_change',
126 kwargs={
127 'template_name': 'chercheurs/password_change_form.html',
128 'post_change_redirect': '/chercheurs/changement-mdp-fini/'
129 },
130 name='chercheurs-password-change'),
131 url(r'^chercheurs/changement-mdp-fini/$',
132 'django.contrib.auth.views.password_change_done',
133 kwargs={'template_name': 'chercheurs/password_change_done.html'},
134 name='chercheurs-password-change-done'),
ff752682
PP
135
136 # Oublié mot de passe
31249cf3
EMS
137 url(r'^chercheurs/oubli-mdp/$', 'django.contrib.auth.views.password_reset',
138 kwargs={
139 'template_name': 'chercheurs/password_reset_form.html',
140 'email_template_name': 'chercheurs/password_reset_email.txt',
141 'post_reset_redirect': '/chercheurs/oubli-mdp-envoye/'
142 },
143 name='chercheurs-password-reset'),
144 url(r'^chercheurs/oubli-mdp-envoye/$',
145 'django.contrib.auth.views.password_reset_done',
146 kwargs={'template_name': 'chercheurs/password_reset_done.html'},
147 name='chercheurs-password-reset-done'),
148 url(r'^chercheurs/oubli-mdp-retour/(?P<uidb36>.*)/(?P<token>.*)/$',
149 'django.contrib.auth.views.password_reset_confirm',
150 kwargs={'template_name': 'chercheurs/password_reset_confirm.html'},
151 name='chercheurs-password-reset-confirm'),
152 url(r'^chercheurs/oubli-mdp-fini/$',
153 'django.contrib.auth.views.password_reset_complete',
154 kwargs={'template_name': 'chercheurs/password_reset_complete.html'}),
ff752682
PP
155
156 # Réactiver fiche
157 url(r'^chercheurs/reactiver/$', 'django.contrib.auth.views.password_reset',
158 kwargs={
159 'template_name': 'chercheurs/reactiver_form.html',
160 'email_template_name': 'chercheurs/reactiver_email.txt',
161 'post_reset_redirect': '/chercheurs/reactiver-envoye/'
162 },
163 name='chercheurs-reactiver'),
164 url(r'^chercheurs/reactiver-envoye/$',
165 'django.contrib.auth.views.password_reset_done',
166 kwargs={'template_name': 'chercheurs/reactiver_done.html'},
167 name='chercheurs-reactiver-done'),
168 url(r'^chercheurs/reactiver-retour/(?P<uidb36>.*)/(?P<token>.*)/$',
169 'django.contrib.auth.views.password_reset_confirm',
170 kwargs={'template_name': 'chercheurs/reactiver_confirm.html',
171 'set_password_form': ReactiverForm},
172 name='chercheurs-reactiver-confirm'),
173 url(r'^chercheurs/reactiver-fini/$',
174 'django.contrib.auth.views.password_reset_complete',
175 kwargs={'template_name': 'chercheurs/reactiver_complete.html'}),
176
177 # auto complete
31249cf3
EMS
178 url(r'^etablissements/autocomplete/$',
179 'chercheurs.views.etablissements_autocomplete'),
180 url(r'^etablissements/autocomplete/(?P<pays>.*)/$',
181 'chercheurs.views.etablissements_autocomplete'),
9af73c99 182
bf563475 183 # API chercheurs
31249cf3
EMS
184 url(r'^api/chercheurs/(?P<chercheur_id>\d+)/$', 'chercheurs.api.api'),
185 url(r'^api/chercheurs/pays/(?P<pays>.*)/$', 'chercheurs.api.api'),
186 url(r'^api/chercheurs/region/(?P<region>.*)/$', 'chercheurs.api.api'),
68d2688e 187 url(r'^api/chercheurs/recherche', 'chercheurs.api.recherche'),
bf563475
NBV
188
189
cdaadee3 190 # groupes
31249cf3
EMS
191 url(r'^groupes/$', 'chercheurs.views.groupe_index'),
192 url(r'^groupes/(?P<id>\d+)/$', 'chercheurs.views.groupe_retrieve',
193 name='groupe_retrieve'),
194 url(r'^groupes/(?P<id>\d+)/adhesion/$', 'chercheurs.views.groupe_adhesion',
195 name='groupe_adhesion'),
196 url(r'^groupes/(?P<id>\d+)/membres/$', 'chercheurs.views.groupe_membres',
197 name='groupe_membres'),
198 url(r'^groupes/(?P<id>\d+)/messages/$', 'chercheurs.views.groupe_messages',
199 name='groupe_messages'),
cdaadee3 200
bae03b7b 201 # section par discipline et/ou région
31249cf3
EMS
202 url(r'^discipline/(?P<discipline>\d+)/', include(sep_patterns)),
203 url(r'^region/(?P<region>\d+)/', include(sep_patterns)),
204 url(r'^discipline/(?P<discipline>\d+)/region/(?P<region>\d+)/',
205 include(sep_patterns)),
bae03b7b
EMS
206
207 # traduction disponible dans le frontend sans permissons
31249cf3 208 url(r'^jsi18n/$', admin.site.i18n_javascript),
bae03b7b 209
c4312cce 210 # Rappels
31249cf3
EMS
211 url(r'^admin/rappels/$', 'rappels.views.admin_rappels',
212 name='admin-rappels'),
c4312cce
PP
213
214 # Admin
bae03b7b 215 url(r'^admin_tools/', include('admin_tools.urls')),
31249cf3
EMS
216 url(r'^admin/', include(admin.site.urls)),
217 url(r'^admin/confirmation/(.*)', 'savoirs.admin_views.confirmation'),
218 url(r'^admin/assigner_pays', 'savoirs.admin_views.assigner_pays'),
219 url(r'^admin/assigner_thematiques',
220 'savoirs.admin_views.assigner_thematiques'),
221 url(r'^admin/assigner_categorie',
222 'savoirs.admin_views.assigner_categorie'),
223 url(r'^admin/assigner_cgstatut',
224 'chercheurs.admin_views.assigner_cgstatut'),
225 url(r'^admin/(?P<app_name>[^/]*)/(?P<model_name>[^/]*)/assigner_regions',
226 'savoirs.admin_views.assigner_regions',
227 name='assigner_regions'),
228 url(r'^admin/(?P<app_name>[^/]*)/(?P<model_name>[^/]*)/'
229 r'assigner_disciplines',
230 'savoirs.admin_views.assigner_disciplines',
231 name='assigner_disciplines'),
232 url(r'^admin/chercheurs/chercheur/export',
233 'chercheurs.admin_views.export'),
234 url(r'^admin/', include(admin.site.urls)),
bae03b7b 235
9c29b8d4 236 # stats
31249cf3 237 url(r'^stats/$', 'savoirs.admin_views.stats', name='stats'),
bae03b7b 238
c4312cce 239
bae03b7b 240 # rss
31249cf3
EMS
241 url(r'^rss/chercheurs/$', FilChercheurs(), name='rss_chercheurs'),
242 url(r'^rss/ressources/$', FilRessources(), name='rss_ressources'),
243 url(r'^rss/actualites/$', FilActualites(), name='rss_actualites'),
244 url(r'^rss/appels/$', FilAppels(), name='rss_appels'),
245 url(r'^rss/agenda/$', FilEvenements(), name='rss_agenda'),
246 url(r'^rss/sites/$', FilSites(), name='rss_sites'),
247 url(r'^rss/messages/(?P<groupe_id>\d+)/$', FilMessages(),
248 name='rss_messages'),
249 url(r'^json/get/$', 'savoirs.views.json_get'),
250 url(r'^json/set/$', 'savoirs.views.json_set'),
1719bf4e 251
fdcf5874 252 # recherches sauvegardées
31249cf3
EMS
253 url(r'^recherches/$', 'savoirs.views.recherches', name='recherches'),
254 url(r'^recherches/(?P<type>[^/]*)/sauvegarder/$',
255 'savoirs.views.sauvegarder_recherche',
256 name='sauvegarder_recherche'),
257 url(r'^recherches/(?P<id>\d+)/supprimer/$',
258 'savoirs.views.supprimer_recherche',
259 name='supprimer_recherche'),
260 url(r'^recherches/(?P<id>\d+)/editer/$',
261 'savoirs.views.editer_recherche',
262 name='editer_recherche'),
263 url(r'^recherches/(?P<id>\d+)/activer-alerte/$',
264 'savoirs.views.activer_alerte',
265 name='activer_alerte'),
266 url(r'^recherches/(?P<id>\d+)/desactiver-alerte/$',
267 'savoirs.views.desactiver_alerte',
268 name='desactiver_alerte'),
b8af106e
PP
269
270 # API Interface (FAUN)
31249cf3
EMS
271 url(r'^faun/auteurs/(?P<id>\d+)', 'interfaces.views.faun_auteurs',
272 name='faun_auteurs'),
57004576
PP
273
274 # Django-selectable
275 (r'^djselectable/', include('selectable.urls')),
2a35a9cd 276
9f43a123
PP
277 # Robots.txt et Sitemaps
278 (r'^robots\.txt$', RobotsTxtView.as_view()),
279 (r'^sitemap\.xml$', 'django.contrib.sitemaps.views.index', {'sitemaps': sitemaps}),
280 (r'^sitemap-(?P<section>.+)\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}),
281
fc702e9e
PP
282 # Plan du site
283 url(r'^plan-du-site/$', TemplateView.as_view(template_name='plan_site.html'), name='plan-site'),
284
2a35a9cd
PP
285 # Page statique ?
286 url(r'^(?P<id>.*)/$', 'savoirs.views.page_statique'),
287
31249cf3 288) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)