team-3/src/c3nav/editor/urls.py

22 lines
943 B
Python
Raw Normal View History

2016-08-31 17:14:31 +02:00
from django.conf.urls import url
2017-05-16 17:45:56 +02:00
from c3nav.editor.views import edit, list_objects, main_index, section_detail
2016-09-23 15:23:02 +02:00
2017-05-16 18:08:07 +02:00
def add_editor_urls(name, model):
return [
url(r'^'+name+r'/$', list_objects, name='editor.'+name+'.list', kwargs={'model': model}),
url(r'^'+name+r'/(?P<pk>[0-9]+)/$', edit, name='editor.'+name+'.edit', kwargs={'model': model}),
url(r'^'+name+r'/create$', edit, name='editor.'+name+'.create', kwargs={'model': model}),
]
2016-08-31 17:14:31 +02:00
urlpatterns = [
2017-05-14 20:21:33 +02:00
url(r'^$', main_index, name='editor.index'),
url(r'^sections/(?P<pk>[0-9]+)/$', section_detail, name='editor.section'),
url(r'^sections/(?P<pk>[0-9]+)/edit$', edit, name='editor.section.edit', kwargs={'model': 'Section'}),
2017-05-16 15:51:56 +02:00
url(r'^sections/create$', edit, name='editor.section.create', kwargs={'model': 'Section'}),
2016-08-31 17:14:31 +02:00
]
2017-05-16 18:08:07 +02:00
urlpatterns.extend(add_editor_urls('locationgroups', 'LocationGroup'))
urlpatterns.extend(add_editor_urls('doors', 'Door'))