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