src/iconolab/urls.py
author Alexandre Segura <mex.zktk@gmail.com>
Wed, 17 May 2017 16:38:08 +0200
changeset 506 4e18e1f69db9
parent 482 b71475c27159
child 522 2d9660ad4a94
permissions -rw-r--r--
Introduce bookmarks feature.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
c1d03ab4baad prepare for publication
ymh <ymh.work@gmail.com>
parents: 151
diff changeset
    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
460
5fe876675e24 Add forgot password.
Alexandre Segura <mex.zktk@gmail.com>
parents: 443
diff changeset
    26
from django.contrib.auth.views import password_reset, password_reset_done, password_reset_confirm, password_reset_complete
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),
238
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'^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
    34
    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
    35
    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
    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")),
238
ad770589f0fe Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents: 217
diff changeset
    38
    url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/(?P<image_guid>[^/]+)$', views.objects.ShowImageView.as_view(), name='image_detail'),
506
4e18e1f69db9 Introduce bookmarks feature.
Alexandre Segura <mex.zktk@gmail.com>
parents: 482
diff changeset
    39
    url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/(?P<image_guid>[^/]+)/bookmark/?$', views.objects.BookmarkImageView.as_view(), name='image_bookmark'),
121
1264552829f8 use proper collection name in breadcrumbs + fixed 404 errors and added redirections for urlbar navigation
durandn
parents: 110
diff changeset
    40
    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
    41
    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'),
470
6c43539e5c67 Use browser history instead of hash for annotation URL.
Alexandre Segura <mex.zktk@gmail.com>
parents: 469
diff changeset
    42
    url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/(?P<image_guid>[^/]+)/annotations/(?P<annotation_guid>[^/]+)/?$', views.objects.ShowAnnotationView.as_view(), name='annotation_detail'),
6c43539e5c67 Use browser history instead of hash for annotation URL.
Alexandre Segura <mex.zktk@gmail.com>
parents: 469
diff changeset
    43
    url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/(?P<image_guid>[^/]+)/annotations/(?P<annotation_guid>[^/]+)/detail$', views.objects.ShowAnnotationViewOld.as_view(), name='annotation_detail_old'),
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
    44
    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
    45
    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'),
482
b71475c27159 Add page with list of revisions.
Alexandre Segura <mex.zktk@gmail.com>
parents: 470
diff changeset
    46
    url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/(?P<image_guid>[^/]+)/annotations/(?P<annotation_guid>[^/]+)/revisions/?$', views.objects.ShowRevisionsView.as_view(), name='annotation_revisions'),
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'^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
    48
    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
    49
469
287af0822445 Fix URL scheme for user pages.
Alexandre Segura <mex.zktk@gmail.com>
parents: 460
diff changeset
    50
    url(r'^user/settings/?$', login_required(views.userpages.UserSettingsView.as_view()), name="user_settings"),
287af0822445 Fix URL scheme for user pages.
Alexandre Segura <mex.zktk@gmail.com>
parents: 460
diff changeset
    51
    url(r'^user/collections/?$', login_required(views.userpages.UserCollectionsView.as_view()), name="user_collections"),
287af0822445 Fix URL scheme for user pages.
Alexandre Segura <mex.zktk@gmail.com>
parents: 460
diff changeset
    52
    url(r'^user/notifications/', include(notifications.urls, namespace='notifications')),
287af0822445 Fix URL scheme for user pages.
Alexandre Segura <mex.zktk@gmail.com>
parents: 460
diff changeset
    53
    url(r'^user/(?P<slug>[a-z0-9\-]+)/?$', views.userpages.UserHomeView.as_view(), name="user_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
    54
    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
    55
    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
    56
    url(r'^user/(?P<slug>[a-z0-9\-]+)/annotations/?$', views.userpages.UserAnnotationsView.as_view(), name="user_annotations"),
506
4e18e1f69db9 Introduce bookmarks feature.
Alexandre Segura <mex.zktk@gmail.com>
parents: 482
diff changeset
    57
    url(r'^user/(?P<slug>[a-z0-9\-]+)/bookmarks/?$', views.userpages.UserBookmarksView.as_view(), name="user_bookmarks"),
4e18e1f69db9 Introduce bookmarks feature.
Alexandre Segura <mex.zktk@gmail.com>
parents: 482
diff changeset
    58
    url(r'^bookmarks/(?P<bookmark>[0-9]+)/delete/?$', views.userpages.BookmarkDeleteView.as_view(), name="bookmark_delete"),
4e18e1f69db9 Introduce bookmarks feature.
Alexandre Segura <mex.zktk@gmail.com>
parents: 482
diff changeset
    59
    url(r'^bookmarks/(?P<bookmark>[0-9]+)/edit/?$', views.userpages.BookmarkEditView.as_view(), name="bookmark_edit"),
469
287af0822445 Fix URL scheme for user pages.
Alexandre Segura <mex.zktk@gmail.com>
parents: 460
diff changeset
    60
    url(r'^user/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
    61
    url(r'^user/notifications/all/?$', login_required(views.userpages.UserNotificationsView.as_view()), name="user_notifications"),
288
9273f1f2c827 clean README text, remove unnecesary settings, refresh base requirements
ymh <ymh.work@gmail.com>
parents: 282
diff changeset
    62
238
ad770589f0fe Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents: 217
diff changeset
    63
    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
    64
238
ad770589f0fe Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents: 217
diff changeset
    65
    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
    66
    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
    67
    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
    68
    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
    69
    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
    70
8
7e49ce535296 fragment editor
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents: 6
diff changeset
    71
    url(r'^account/', include('iconolab.auth.urls', namespace='account')),
460
5fe876675e24 Add forgot password.
Alexandre Segura <mex.zktk@gmail.com>
parents: 443
diff changeset
    72
    url(r'^password/reset$', password_reset, name='password_reset'),
5fe876675e24 Add forgot password.
Alexandre Segura <mex.zktk@gmail.com>
parents: 443
diff changeset
    73
    url(r'^password/reset/done$', password_reset_done, name='password_reset_done'),
5fe876675e24 Add forgot password.
Alexandre Segura <mex.zktk@gmail.com>
parents: 443
diff changeset
    74
    url(r'^password/reset/complete$', password_reset_complete, name='password_reset_complete'),
5fe876675e24 Add forgot password.
Alexandre Segura <mex.zktk@gmail.com>
parents: 443
diff changeset
    75
    url(r'^password/reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', password_reset_confirm, name='password_reset_confirm'),
5fe876675e24 Add forgot password.
Alexandre Segura <mex.zktk@gmail.com>
parents: 443
diff changeset
    76
217
8a9c7188bfa8 cleaned up search as a package
durandn
parents: 212
diff changeset
    77
    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
    78
    url(r'^comments/', include('django_comments_xtd.urls')),
106
233bda6f2865 iconolab search
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents: 105
diff changeset
    79
    url(r'^comments/annotation/post', views.comments.post_comment_iconolab, name="post_comment"),
323
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents: 288
diff changeset
    80
    url(r'^comments/annotation/(?P<annotation_guid>[^/]+)/comment-form$', views.comments.get_comment_form, name="get_comment_form"),
55c024fc7c60 Roughly implement annotation navigator.
Alexandre Segura <mex.zktk@gmail.com>
parents: 288
diff changeset
    81
    url(r'^comments/annotation/(?P<annotation_guid>[^/]+)/comments.json$', views.comments.get_annotation_comments_json, name="get_annotation_comments_json"),
288
9273f1f2c827 clean README text, remove unnecesary settings, refresh base requirements
ymh <ymh.work@gmail.com>
parents: 282
diff changeset
    82
238
ad770589f0fe Work on admin interface and user pages + added stat metacategories count for annotations + refactored views module #41
durandn
parents: 217
diff changeset
    83
    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
    84
    #url(r'^search/', include('haystack.urls'), name="search_iconolab"),
6
37baf9d13f32 first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
    85
]
37baf9d13f32 first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
    86
155
c1d03ab4baad prepare for publication
ymh <ymh.work@gmail.com>
parents: 151
diff changeset
    87
c1d03ab4baad prepare for publication
ymh <ymh.work@gmail.com>
parents: 151
diff changeset
    88
if settings.DJANGO_RUNSERVER:
c1d03ab4baad prepare for publication
ymh <ymh.work@gmail.com>
parents: 151
diff changeset
    89
    urlpatterns += staticfiles_urlpatterns()
c1d03ab4baad prepare for publication
ymh <ymh.work@gmail.com>
parents: 151
diff changeset
    90
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
c1d03ab4baad prepare for publication
ymh <ymh.work@gmail.com>
parents: 151
diff changeset
    91
    #static url
c1d03ab4baad prepare for publication
ymh <ymh.work@gmail.com>
parents: 151
diff changeset
    92
    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)