Django 1.6.
[prawokultury.git] / prawokultury / urls.py
1 # -*- coding: utf-8 -*-
2 # This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4 #
5 from django.conf import settings
6 from django.conf.urls import patterns, include, url
7 from django.contrib import admin
8 from django.contrib.staticfiles.urls import staticfiles_urlpatterns
9 from django.utils.translation import ugettext_lazy as _, string_concat
10 from fnpdjango.utils.urls import i18n_patterns
11 from events.urls import urlpatterns as events_urlpatterns
12 from migdal.urls import urlpatterns as migdal_urlpatterns
13
14 admin.autodiscover()
15
16 urlpatterns = patterns('',
17     url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
18             'document_root': settings.MEDIA_ROOT,
19         }),
20     url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')),
21     )
22
23 if 'django.contrib.sitemaps' in settings.INSTALLED_APPS:
24     from migdal.sitemap import sitemaps as migdal_sitemaps
25     from questions.sitemap import sitemaps as question_sitemaps
26     sitemaps = dict(migdal_sitemaps.items() + question_sitemaps.items())
27     urlpatterns += patterns('',
28         url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {
29             'sitemaps': sitemaps
30         }),
31     )
32
33 if 'django_cas' in settings.INSTALLED_APPS:
34     urlpatterns += patterns('',
35         (r'^accounts/login/$', 'django_cas.views.login'),
36         (r'^accounts/logout/$', 'django_cas.views.logout'),
37         (r'^admin/login/$', 'django_cas.views.login'),
38         (r'^admin/logout/$', 'django_cas.views.logout'),
39     )
40
41 urlpatterns += patterns('',
42     url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
43     url(r'^admin/', include(admin.site.urls)),
44 )
45
46 urlpatterns += i18n_patterns('',
47     url(string_concat(r'^', _('events'), r'/'), include('events.urls')),
48     url(r'^comments/', include('django_comments_xtd.urls')),
49     url(r'^pierwsza-pomoc/', include('questions.urls')),
50     url(string_concat(r'^', _('shop'), r'/'), include('shop.urls')),
51 ) + migdal_urlpatterns 
52
53 if settings.DEBUG:
54     urlpatterns += patterns('',
55         url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
56             'document_root': settings.MEDIA_ROOT,
57         }),
58    )
59
60 urlpatterns += staticfiles_urlpatterns()