| author | durandn |
| Fri, 16 Sep 2016 12:07:53 +0200 | |
| changeset 183 | b57504a2983f |
| parent 155 | c1d03ab4baad |
| child 190 | 0230f85c0595 |
| 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 |
|
233bda6f2865
iconolab search
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
105
diff
changeset
|
22 |
from iconolab.search_indexes.views import IconolabSearchView |
| 155 | 23 |
from django.conf import settings |
|
6
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
24 |
|
|
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
25 |
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
|
26 |
from django.contrib.auth.decorators import login_required |
|
6
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
27 |
from django.contrib.staticfiles.urls import staticfiles_urlpatterns |
|
106
233bda6f2865
iconolab search
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
105
diff
changeset
|
28 |
import notifications.urls |
|
6
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
29 |
|
|
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
30 |
urlpatterns = [ |
|
121
1264552829f8
use proper collection name in breadcrumbs + fixed 404 errors and added redirections for urlbar navigation
durandn
parents:
110
diff
changeset
|
31 |
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
|
32 |
url(r'^admin/', admin.site.urls), |
| 183 | 33 |
url(r'^home$', views.iconolab_objects.GlobalHomepageView.as_view(), name="home"), |
34 |
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)$', views.iconolab_objects.CollectionHomepageView.as_view(), name='collection_home'), # Home fond |
|
35 |
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/items/(?P<item_guid>[^/]+)$', views.iconolab_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
|
36 |
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
|
37 |
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/?$', django_views.generic.RedirectView.as_view(pattern_name="collection_home")), |
| 183 | 38 |
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/(?P<image_guid>[^/]+)$', views.iconolab_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
|
39 |
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/(?P<image_guid>[^/]+)/annotations/?$', django_views.generic.RedirectView.as_view(pattern_name="image_detail")), |
| 183 | 40 |
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/(?P<image_guid>[^/]+)/annotations/create$', login_required(views.iconolab_objects.CreateAnnotationView.as_view()), name='annotation_create'), |
41 |
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/(?P<image_guid>[^/]+)/annotations/(?P<annotation_guid>[^/]+)/detail$', views.iconolab_objects.ShowAnnotationView.as_view(), name='annotation_detail'), |
|
42 |
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/(?P<image_guid>[^/]+)/annotations/(?P<annotation_guid>[^/]+)/edit$', login_required(views.iconolab_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")), |
| 183 | 44 |
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/(?P<image_guid>[^/]+)/annotations/(?P<annotation_guid>[^/]+)/revisions/(?P<revision_guid>[^/]+)/detail', views.iconolab_objects.ShowRevisionView.as_view(), name='revision_detail'), |
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.iconolab_objects.MergeProposalView.as_view()), name='annotation_merge'), |
|
46 |
url(r'^user/(?P<slug>[a-z0-9\-]+)/home/?$', views.iconolab_objects.UserHomeView.as_view(), name="user_home"), |
|
47 |
url(r'^user/notifications/all/?$', login_required(views.iconolab_objects.UserNotificationsView.as_view()), name="user_notifications"), |
|
48 |
url(r'^errors/404', views.iconolab_misc.NotFoundErrorView.as_view(), name="404error"), |
|
49 |
url(r'^help/', views.iconolab_misc.HelpView.as_view(), name="iconolab_help"), |
|
50 |
url(r'^credits/', views.iconolab_misc.CreditsView.as_view(), name="iconolab_credits"), |
|
51 |
url(r'^contributioncharter/', views.iconolab_misc.ContributionCharterView.as_view(), name="iconolab_charter"), |
|
52 |
url(r'^contributioncharter/', views.iconolab_misc.LegalMentionsView.as_view(), name="iconolab_legals"), |
|
53 |
||
|
8
7e49ce535296
fragment editor
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
6
diff
changeset
|
54 |
url(r'^account/', include('iconolab.auth.urls', namespace='account')), |
|
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
|
55 |
url(r'^comments/', include('django_comments_xtd.urls')), |
|
106
233bda6f2865
iconolab search
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
105
diff
changeset
|
56 |
url(r'^comments/annotation/post', views.comments.post_comment_iconolab, name="post_comment"), |
|
233bda6f2865
iconolab search
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
105
diff
changeset
|
57 |
url('^user/notifications/', include(notifications.urls, namespace='notifications')), |
| 155 | 58 |
|
|
124
e5267573edd8
search engine
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
110
diff
changeset
|
59 |
url(r'collections/(?P<collection_name>[a-z0-9\-]+)/search/(?P<model_type>[a-z0-9\-]+)', IconolabSearchView.as_view(), name="collection_with_model_search"), |
|
e5267573edd8
search engine
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
110
diff
changeset
|
60 |
|
|
e5267573edd8
search engine
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
110
diff
changeset
|
61 |
url(r'^search/(?P<model_type>[a-z0-9\-]+)', IconolabSearchView.as_view(), name="model_search"), |
|
e5267573edd8
search engine
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
110
diff
changeset
|
62 |
|
|
e5267573edd8
search engine
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
110
diff
changeset
|
63 |
url(r'collections/(?P<collection_name>[a-z0-9\-]+)/search', IconolabSearchView.as_view(), name="collection_haystack_search"), |
|
106
233bda6f2865
iconolab search
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
105
diff
changeset
|
64 |
url(r'^search/$', IconolabSearchView.as_view(), name="haystack_search"), |
| 183 | 65 |
url(r'^compare/$', views.iconolab_objects.TestView.as_view(), name="compare_view") |
|
106
233bda6f2865
iconolab search
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
105
diff
changeset
|
66 |
#url(r'^search/', include('haystack.urls'), name="search_iconolab"), |
|
6
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
67 |
] |
|
37baf9d13f32
first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff
changeset
|
68 |
|
| 155 | 69 |
|
70 |
if settings.DJANGO_RUNSERVER: |
|
71 |
urlpatterns += staticfiles_urlpatterns() |
|
72 |
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) |
|
73 |
#static url |
|
74 |
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) |