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