e107635ea44fe707055d6b729c272b0302b452c5
[redakcja.git] / project / urls.py
1 # -*- coding: utf-8 -*-
2
3 from django.conf.urls.defaults import *
4 from django.contrib import admin
5 from django.conf import settings
6
7 admin.autodiscover()
8 PATH_SEC = r"(?P<path>[^/]+)"
9 PATH_END = PATH_SEC + "/$"
10
11 urlpatterns = patterns('',
12     # Explorer:
13     url(r'^$', 'explorer.views.file_list', name='file_list'),        
14     url(r'^file/upload', 'explorer.views.file_upload', name='file_upload'),
15
16
17     url(r'^managment/pull-requests$', 'explorer.views.pull_requests'),
18     
19 #    url(r'^images/(?P<folder>[^/]+)/$', 'explorer.views.folder_images', name='folder_image'),
20 #    url(r'^images/$', 'explorer.views.folder_images', {'folder': '.'}, name='folder_image_ajax'),
21     
22     # Editor panels
23  #   url(r'^editor/'+PATH_SEC+'/panel/(?P<name>[a-z]+)/$', 'explorer.views.panel_view', name='panel_view'),
24     url(r'^editor/'+PATH_END, 'explorer.views.display_editor', name='editor_view'),
25     url(r'^editor/$', 'explorer.views.file_list', name='editor_base'),
26
27  #   url(r'^editor/'+PATH_SEC+'/split$', 'explorer.views.split_text'),
28  #   url(r'^editor/'+PATH_SEC+'/split-success',
29  #       'explorer.views.split_success', name='split-success'),
30
31  #   url(r'^editor/'+PATH_SEC+'/print/html$', 'explorer.views.print_html'),
32  #   url(r'^editor/'+PATH_SEC+'/print/xml$', 'explorer.views.print_xml'),
33
34     url(r'^file/(?P<docid>[^/]+)/print$', 'explorer.views.print_html', name="file_print"),
35     # Task managment
36     # url(r'^manager/pull-requests$', 'explorer.views.pull_requests'),
37
38     # Admin panel
39     url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
40     url(r'^admin/(.*)', admin.site.root),
41
42     # Prototypes
43 #    url(r'^wysiwyg-proto/', include('wysiwyg.urls')),
44
45     # Our über-restful api
46     url(r'^api/', include('api.urls') ),
47     
48 )
49
50 if 'cas_consumer' in settings.INSTALLED_APPS:
51     urlpatterns += patterns('',
52         # django-cas-consumer
53         url(r'^accounts/login/$', 'cas_consumer.views.login', name='login'),
54         url(r'^accounts/logout/$', 'cas_consumer.views.logout', name='logout'),
55     )
56 else:
57     urlpatterns += patterns('',
58         # Django auth
59         url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'redirect_field_name': 'next'}, name='login'),
60         url(r'^accounts/logout/$', 'django.contrib.auth.views.logout', {'next_page': '/'}, name='logout'),    
61     )
62
63 # Static files
64 if settings.DEBUG and not hasattr(settings, 'DONT_SERVE_STATIC'):
65     urlpatterns += patterns('',
66         url(r'^%s(?P<path>.+)$' % settings.MEDIA_URL[1:], 'django.views.static.serve',
67             {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
68         url(r'^%s(?P<path>.+)$' % settings.STATIC_URL[1:], 'django.views.static.serve',
69             {'document_root': settings.STATIC_ROOT, 'show_indexes': True}),
70     )
71