551f2e07df196258fb28e7ba58f1f9c3f2ec9daa
[redakcja.git] / project / urls.py
1 from django.conf.urls.defaults import *
2 from django.contrib import admin
3 from django.conf import settings
4
5 admin.autodiscover()
6 PATH_END = r"(?P<path>[^/]+)$"
7
8 urlpatterns = patterns('',
9     # Explorer:
10     url(r'^$', 'explorer.views.file_list', name='file_list'),
11     
12     url(r'^file/text/'+PATH_END, 'explorer.views.file_xml', name='file_xml'),
13     url(r'^file/dc/'+PATH_END, 'explorer.views.file_dc', name='file_dc'),
14     url(r'^file/upload', 'explorer.views.file_upload', name='file_upload'),
15
16     url(r'^images/(?P<folder>[^/]+)/$', 'explorer.views.folder_images', name='folder_image'),
17     url(r'^images/$', 'explorer.views.folder_images', {'folder': '.'}, name='folder_image_ajax'),
18     
19     # Editor panels
20     url(r'^editor/panel/xmleditor/'+PATH_END, 'explorer.views.xmleditor_panel', name='xmleditor_panel'),
21     url(r'^editor/panel/gallery/'+PATH_END, 'explorer.views.gallery_panel', name='gallery_panel'),
22     url(r'^editor/panel/htmleditor/'+PATH_END, 'explorer.views.htmleditor_panel', name='htmleditor_panel'),
23     url(r'^editor/panel/dceditor/'+PATH_END, 'explorer.views.dceditor_panel', name='dceditor_panel'),
24     url(r'^editor/'+PATH_END, 'explorer.views.display_editor', name='editor_view'),
25
26     # Task managment
27     url(r'^manager/pull-requests$', 'explorer.views.pull_requests'),
28
29     # Admin panel
30     url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
31     url(r'^admin/(.*)', admin.site.root),
32
33     # Authorization
34     url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'redirect_field_name': 'next'}),
35     url(r'^accounts/logout$', 'django.contrib.auth.views.logout', {'next_page': '/'}),
36 )
37
38
39 # Static files
40 if settings.DEBUG:
41     urlpatterns += patterns('',
42         url(r'^%s(?P<path>.+)$' % settings.MEDIA_URL[1:], 'django.views.static.serve', 
43             {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
44         url(r'^%s(?P<path>.+)$' % settings.STATIC_URL[1:], 'django.views.static.serve',
45             {'document_root': settings.STATIC_ROOT, 'show_indexes': True}),
46     )