4e672f3e13c5738b57c16d1ab6ee96362b921268
[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
15     url(r'^images/(?P<folder>[^/]+)/$', 'explorer.views.folder_images', name='folder_image'),
16     url(r'^images/$', 'explorer.views.folder_images', {'folder': '.'}, name='folder_image_ajax'),
17     
18     # Editor panels
19     url(r'^editor/panel/xmleditor/'+PATH_END, 'explorer.views.xmleditor_panel', name='xmleditor_panel'),
20     url(r'^editor/panel/gallery/'+PATH_END, 'explorer.views.gallery_panel', name='gallery_panel'),
21     url(r'^editor/panel/htmleditor/'+PATH_END, 'explorer.views.htmleditor_panel', name='htmleditor_panel'),
22     url(r'^editor/panel/dceditor/'+PATH_END, 'explorer.views.dceditor_panel', name='dceditor_panel'),
23     url(r'^editor/'+PATH_END, 'explorer.views.display_editor', name='editor_view'),
24
25     # Admin panel
26     url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
27     url(r'^admin/(.*)', admin.site.root),
28
29     # Authorization
30     url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'redirect_field_name': 'next_page'}),
31     url(r'^accounts/logout$', 'django.contrib.auth.views.logout', {'next_page': '/'}), # {'redirect_field_name': 'next_page'}),
32 )
33
34
35 # Static files
36 if settings.DEBUG:
37     urlpatterns += patterns('',
38         url(r'^%s(?P<path>.+)$' % settings.MEDIA_URL[1:], 'django.views.static.serve', 
39             {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
40         url(r'^%s(?P<path>.+)$' % settings.STATIC_URL[1:], 'django.views.static.serve',
41             {'document_root': settings.STATIC_ROOT, 'show_indexes': True}),
42     )