src/iconolab/urls.py
author durandn
Tue, 21 Jun 2016 14:38:09 +0200
changeset 24 6b6b183447a2
parent 20 91e7f0429e4f
child 33 f9d4c9a63e4e
permissions -rw-r--r--
work on models + auth register/login system + adapted existing app and templates so editing annotations is working as before + created empty templates to fill
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
"""
37baf9d13f32 first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
    16
from django.conf.urls import url, include
37baf9d13f32 first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
    17
from django.contrib import admin
37baf9d13f32 first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
    18
from . import views
37baf9d13f32 first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
    19
from . import settings
37baf9d13f32 first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
    20
37baf9d13f32 first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
    21
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
    22
from django.contrib.auth.decorators import login_required
6
37baf9d13f32 first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
    23
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
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
urlpatterns = [
37baf9d13f32 first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
    26
    url(r'^admin/', admin.site.urls),
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
    27
    url(r'^home$', views.GlobalHomepageView.as_view(), name="home"),
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
    28
    url(r'^collections/(?P<collection_name>[a-z]+)$', views.CollectionHomepageView.as_view(), name='collection_home'), # Home fond
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
    29
    url(r'^collections/(?P<collection_name>[a-z]+)/images/(?P<image_ref>[a-z0-9]+)$', views.ShowImageView.as_view(), name='image_detail'),
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
    30
    url(r'^collections/(?P<collection_name>[a-z]+)/images/(?P<image_ref>[a-z0-9]+)/annotations/create$', login_required(views.CreateAnnotationView.as_view()), name='annotation_create'),
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
    31
    url(r'^collections/(?P<collection_name>[a-z]+)/images/(?P<image_ref>[a-z0-9]+)/annotations/(?P<annotation_guid>[^/]+)/detail$', views.ShowAnnotationView.as_view(), name='annotation_detail'),
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
    32
    url(r'^collections/(?P<collection_name>[a-z]+)/images/(?P<image_ref>[a-z0-9]+)/annotations/(?P<annotation_guid>[^/]+)/edit$', login_required(views.EditAnnotationView.as_view()), name='annotation_edit'),
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
    33
    url(r'^collections/(?P<collection_name>[a-z]+)/images/(?P<image_ref>[a-z0-9]+)/annotations/(?P<annotation_guid>[^/]+)/revisions/(?P<revision_guid>[0-9]+)/merge$', login_required(views.MergeProposalView.as_view()), name='annotation_merge'),
6
37baf9d13f32 first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
    34
    url(r'^rest', include('restapi.urls')),
8
7e49ce535296 fragment editor
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents: 6
diff changeset
    35
    url(r'^account/', include('iconolab.auth.urls', namespace='account')),
6
37baf9d13f32 first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
    36
]
37baf9d13f32 first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
    37
37baf9d13f32 first commit
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
    38
urlpatterns += staticfiles_urlpatterns()
8
7e49ce535296 fragment editor
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents: 6
diff changeset
    39
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)