| author | ymh <ymh.work@gmail.com> |
| Wed, 18 Jan 2017 14:11:30 +0100 | |
| changeset 288 | 9273f1f2c827 |
| parent 282 | 7204cfdde3be |
| child 323 | 55c024fc7c60 |
| permissions | -rw-r--r-- |
|
6
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
1 |
"""iconolab URL Configuration |
|
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
2 |
|
|
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
3 |
The `urlpatterns` list routes URLs to views. For more information please see: |
|
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
4 |
https://docs.djangoproject.com/en/1.9/topics/http/urls/ |
|
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
5 |
Examples: |
|
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
6 |
Function views |
|
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
7 |
1. Add an import: from my_app import views |
|
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
8 |
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') |
|
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
9 |
Class-based views |
|
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
10 |
1. Add an import: from other_app.views import Home |
|
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
11 |
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') |
|
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
12 |
Including another URLconf |
|
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
13 |
1. Import the include() function: from django.conf.urls import url, include |
|
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
14 |
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) |
|
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
15 |
""" |
|
62
8702ab13783e
design work on templates, redirect to home on /, implemented accept and reject revisions shortcuts when applicable
durandn
parents:
59
diff
changeset
|
16 |
from django.core.urlresolvers import reverse_lazy |
|
6
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
17 |
from django.conf.urls import url, include |
|
143
c68983a2efac
fixing url
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
137
diff
changeset
|
18 |
|
|
6
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
19 |
from django.contrib import admin |
|
121
1264552829f8
use proper collection name in breadcrumbs + fixed 404 errors and added redirections for urlbar navigation
durandn
parents:
110
diff
changeset
|
20 |
from django import views as django_views |
|
106
233bda6f2865
iconolab search
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
105
diff
changeset
|
21 |
from iconolab import views |
| 155 | 22 |
from django.conf import settings |
|
6
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
23 |
|
|
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
24 |
from django.conf.urls.static import static |
|
24
6b6b183447a2
work on models + auth register/login system + adapted existing app and templates so editing annotations is working as before + created empty templates to fill
durandn
parents:
20
diff
changeset
|
25 |
from django.contrib.auth.decorators import login_required |
|
6
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
26 |
from django.contrib.staticfiles.urls import staticfiles_urlpatterns |
|
106
233bda6f2865
iconolab search
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
105
diff
changeset
|
27 |
import notifications.urls |
|
6
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
28 |
|
|
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
29 |
urlpatterns = [ |
|
121
1264552829f8
use proper collection name in breadcrumbs + fixed 404 errors and added redirections for urlbar navigation
durandn
parents:
110
diff
changeset
|
30 |
url(r'^$', django_views.generic.RedirectView.as_view(url=reverse_lazy("home"))), |
|
6
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
31 |
url(r'^admin/', admin.site.urls), |
|
238
ad770589f0fe
Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents:
217
diff
changeset
|
32 |
url(r'^home$', views.objects.GlobalHomepageView.as_view(), name="home"), |
|
ad770589f0fe
Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents:
217
diff
changeset
|
33 |
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)$', views.objects.CollectionHomepageView.as_view(), name='collection_home'), # Home fond |
|
ad770589f0fe
Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents:
217
diff
changeset
|
34 |
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/items/(?P<item_guid>[^/]+)$', views.objects.ShowItemView.as_view(), name='item_detail'), |
|
121
1264552829f8
use proper collection name in breadcrumbs + fixed 404 errors and added redirections for urlbar navigation
durandn
parents:
110
diff
changeset
|
35 |
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/items/?$', django_views.generic.RedirectView.as_view(pattern_name="collection_home")), |
|
1264552829f8
use proper collection name in breadcrumbs + fixed 404 errors and added redirections for urlbar navigation
durandn
parents:
110
diff
changeset
|
36 |
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/?$', django_views.generic.RedirectView.as_view(pattern_name="collection_home")), |
|
238
ad770589f0fe
Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents:
217
diff
changeset
|
37 |
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/(?P<image_guid>[^/]+)$', views.objects.ShowImageView.as_view(), name='image_detail'), |
|
121
1264552829f8
use proper collection name in breadcrumbs + fixed 404 errors and added redirections for urlbar navigation
durandn
parents:
110
diff
changeset
|
38 |
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/(?P<image_guid>[^/]+)/annotations/?$', django_views.generic.RedirectView.as_view(pattern_name="image_detail")), |
|
238
ad770589f0fe
Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents:
217
diff
changeset
|
39 |
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/(?P<image_guid>[^/]+)/annotations/create$', login_required(views.objects.CreateAnnotationView.as_view()), name='annotation_create'), |
|
ad770589f0fe
Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents:
217
diff
changeset
|
40 |
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/(?P<image_guid>[^/]+)/annotations/(?P<annotation_guid>[^/]+)/detail$', views.objects.ShowAnnotationView.as_view(), name='annotation_detail'), |
|
282
7204cfdde3be
Added a readonly view for annotation detail that doesn't display comments and edit links + added a link to that view from the admin interface
durandn
parents:
242
diff
changeset
|
41 |
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/(?P<image_guid>[^/]+)/annotations/(?P<annotation_guid>[^/]+)/readonly$', views.objects.ReadonlyAnnotationView.as_view(), name='annotation_readonly'), |
|
238
ad770589f0fe
Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents:
217
diff
changeset
|
42 |
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/(?P<image_guid>[^/]+)/annotations/(?P<annotation_guid>[^/]+)/edit$', login_required(views.objects.EditAnnotationView.as_view()), name='annotation_edit'), |
|
121
1264552829f8
use proper collection name in breadcrumbs + fixed 404 errors and added redirections for urlbar navigation
durandn
parents:
110
diff
changeset
|
43 |
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/(?P<image_guid>[^/]+)/annotations/(?P<annotation_guid>[^/]+)/revisions/?$', django_views.generic.RedirectView.as_view(pattern_name="annotation_detail")), |
|
238
ad770589f0fe
Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents:
217
diff
changeset
|
44 |
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/(?P<image_guid>[^/]+)/annotations/(?P<annotation_guid>[^/]+)/revisions/(?P<revision_guid>[^/]+)/detail', views.objects.ShowRevisionView.as_view(), name='revision_detail'), |
|
ad770589f0fe
Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents:
217
diff
changeset
|
45 |
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/(?P<image_guid>[^/]+)/annotations/(?P<annotation_guid>[^/]+)/revisions/(?P<revision_guid>[^/]+)/merge$', login_required(views.objects.MergeProposalView.as_view()), name='annotation_merge'), |
|
288
9273f1f2c827
clean README text, remove unnecesary settings, refresh base requirements
ymh <ymh.work@gmail.com>
parents:
282
diff
changeset
|
46 |
|
|
238
ad770589f0fe
Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents:
217
diff
changeset
|
47 |
url(r'^user/(?P<slug>[a-z0-9\-]+)/home/?$', views.userpages.UserHomeView.as_view(), name="user_home"), |
|
ad770589f0fe
Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents:
217
diff
changeset
|
48 |
url(r'^user/(?P<slug>[a-z0-9\-]+)/commented/?$', views.userpages.UserCommentedView.as_view(), name="user_commented"), |
|
ad770589f0fe
Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents:
217
diff
changeset
|
49 |
url(r'^user/(?P<slug>[a-z0-9\-]+)/contributed/?$', views.userpages.UserContributedView.as_view(), name="user_contributed"), |
|
ad770589f0fe
Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents:
217
diff
changeset
|
50 |
url(r'^user/(?P<slug>[a-z0-9\-]+)/annotations/?$', views.userpages.UserAnnotationsView.as_view(), name="user_annotations"), |
|
242
430188380ba8
Added option to assign multiple managed collections on one account + small correction on stats template #41
durandn
parents:
238
diff
changeset
|
51 |
url(r'^user/(?P<slug>[a-z0-9\-]+)/adminpanel/(?P<collection_name>[a-z0-9\-]+)/$', views.userpages.UserCollectionAdminView.as_view(), name="user_admin_panel"), |
|
238
ad770589f0fe
Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents:
217
diff
changeset
|
52 |
url(r'^user/notifications/all/?$', login_required(views.userpages.UserNotificationsView.as_view()), name="user_notifications"), |
|
190
0230f85c0595
Properly remove misc views from iconolab_objects.py + added help page that will describe project and link to tutorial #2
durandn
parents:
183
diff
changeset
|
53 |
url(r'^user/notifications/', include(notifications.urls, namespace='notifications')), |
|
288
9273f1f2c827
clean README text, remove unnecesary settings, refresh base requirements
ymh <ymh.work@gmail.com>
parents:
282
diff
changeset
|
54 |
|
|
238
ad770589f0fe
Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents:
217
diff
changeset
|
55 |
url(r'^errors/404', views.misc.NotFoundErrorView.as_view(), name="404error"), |
|
288
9273f1f2c827
clean README text, remove unnecesary settings, refresh base requirements
ymh <ymh.work@gmail.com>
parents:
282
diff
changeset
|
56 |
|
|
238
ad770589f0fe
Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents:
217
diff
changeset
|
57 |
url(r'^help/', views.misc.HelpView.as_view(), name="iconolab_help"), |
|
ad770589f0fe
Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents:
217
diff
changeset
|
58 |
url(r'^glossary/', views.misc.GlossaryView.as_view(), name="iconolab_glossary"), |
|
ad770589f0fe
Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents:
217
diff
changeset
|
59 |
url(r'^credits/', views.misc.CreditsView.as_view(), name="iconolab_credits"), |
|
ad770589f0fe
Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents:
217
diff
changeset
|
60 |
url(r'^contributioncharter/', views.misc.ContributionCharterView.as_view(), name="iconolab_charter"), |
|
ad770589f0fe
Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents:
217
diff
changeset
|
61 |
url(r'^legalmentions/', views.misc.LegalMentionsView.as_view(), name="iconolab_legals"), |
|
288
9273f1f2c827
clean README text, remove unnecesary settings, refresh base requirements
ymh <ymh.work@gmail.com>
parents:
282
diff
changeset
|
62 |
|
|
8
7e49ce535296
fragment editor
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
6
diff
changeset
|
63 |
url(r'^account/', include('iconolab.auth.urls', namespace='account')), |
| 217 | 64 |
url(r'^search/', include('iconolab.search_indexes.urls', namespace='search_indexes')), |
|
42
51257e2701d9
streamlined comment system, replicated post_comment view so form errors redirect on the annotation page and not on a preview page + added revision detail view and links for specific revisions from the comments
durandn
parents:
38
diff
changeset
|
65 |
url(r'^comments/', include('django_comments_xtd.urls')), |
|
106
233bda6f2865
iconolab search
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
105
diff
changeset
|
66 |
url(r'^comments/annotation/post', views.comments.post_comment_iconolab, name="post_comment"), |
|
288
9273f1f2c827
clean README text, remove unnecesary settings, refresh base requirements
ymh <ymh.work@gmail.com>
parents:
282
diff
changeset
|
67 |
|
|
238
ad770589f0fe
Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents:
217
diff
changeset
|
68 |
url(r'^compare/$', views.objects.TestView.as_view(), name="compare_view") |
|
106
233bda6f2865
iconolab search
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
105
diff
changeset
|
69 |
#url(r'^search/', include('haystack.urls'), name="search_iconolab"), |
|
6
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
70 |
] |
|
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
71 |
|
| 155 | 72 |
|
73 |
if settings.DJANGO_RUNSERVER: |
|
74 |
urlpatterns += staticfiles_urlpatterns() |
|
75 |
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) |
|
76 |
#static url |
|
77 |
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) |