workshop form on hold
[edumed.git] / edumed / urls.py
1 # -*- coding: utf-8 -*-
2 from django.conf.urls import patterns, include, url
3 from django.conf import settings
4 from django.contrib.flatpages.views import flatpage
5 from django.shortcuts import redirect
6
7 from .views import HomeView, AvatarlessProfileEditView, flatpage_with_template
8
9 urlpatterns = patterns(
10     '',
11     url(r'^$', HomeView.as_view(), name="home"),
12     url(r'^lekcje/', include('catalogue.urls')),
13     url(r'^info/turniej/(?P<url>.*)$', lambda request, url: redirect('olimpiada', url)),
14     url(r'^info/(?P<url>.*)$', flatpage, name="info"),
15     url(r'^olimpiada/$', lambda request: flatpage(request, 'turniej/'), name='olimpiada'),
16     url(r'^olimpiada/(?P<url>.*)$', lambda request, url: flatpage(request, 'turniej/' + url), name='olimpiada'),
17     url(r'^olimpiada-teaser/(?P<url>.*)$',
18         lambda request, url: flatpage_with_template(request, 'turniej/' + url, 'olimpiada_teaser.html'),
19         name='olimpiada_teaser'),
20     url(r'^szukaj/', include('haystack.urls')),
21     url(r'^zglos/', include('contact.urls')),
22     url(r'^forum/profile/edit/$', AvatarlessProfileEditView.as_view(), name='edit_profile'),
23     url(r'^forum/', include('forum.urls')),
24     url(r'^forum/', include('pybb.urls', namespace='pybb')),
25     url(r'^kompetencje/', include('curriculum.urls')),
26     url(r'^wlem/', include('wtem.urls')),
27     url(r'^api/', include('api.urls')),
28 )
29
30
31 # Admin stuff, if necessary.
32 if 'django.contrib.admin' in settings.INSTALLED_APPS:
33     from django.contrib import admin
34     admin.autodiscover()
35
36     if 'django_cas' in settings.INSTALLED_APPS:
37         urlpatterns += patterns(
38             '',
39             (r'^admin/logout/$', 'django_cas.views.logout'),
40         )
41     urlpatterns += patterns(
42         '',
43         url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
44         url(r'^admin/', include(admin.site.urls)),
45     )
46
47 # Auth stuff, if necessary
48 if 'django_cas' in settings.INSTALLED_APPS:
49     urlpatterns += patterns(
50         '',
51         url(r'^accounts/login/$', 'django_cas.views.login', name='login'),
52         url(r'^accounts/logout/$', 'django_cas.views.logout', name='logout'),
53     )
54
55
56 if settings.DEBUG:
57     from fnpdjango.utils.urls import i18n_patterns
58     from .views import mil_home_view, mil_contact_view, mil_knowledge_base_view
59     urlpatterns += i18n_patterns(
60         '',
61         url(r'^katalog/$', mil_home_view, name="mil_home"),
62         url(r'^wez-udzial/', include('comment.urls')),
63         url(r'^kontakt/$', mil_contact_view, name='mil_contact'),
64         url(r'^bazawiedzy/(?P<url>.*)$', mil_knowledge_base_view, name="knowledge_base"),
65     )
66
67
68 if settings.DEBUG:
69     urlpatterns += patterns(
70         '',
71         url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
72             'document_root': settings.MEDIA_ROOT,
73         }),
74     )