diff --git a/src/c3nav/editor/converters.py b/src/c3nav/editor/converters.py deleted file mode 100644 index 53afc062..00000000 --- a/src/c3nav/editor/converters.py +++ /dev/null @@ -1,8 +0,0 @@ -class EditPkConverter: - regex = r'c?\d+' - - def to_python(self, value): - return value - - def to_url(self, value): - return value diff --git a/src/c3nav/editor/urls.py b/src/c3nav/editor/urls.py index 6992192a..89ffb95b 100644 --- a/src/c3nav/editor/urls.py +++ b/src/c3nav/editor/urls.py @@ -1,15 +1,12 @@ from django.apps import apps -from django.urls import path, register_converter +from django.urls import path -from c3nav.editor.converters import EditPkConverter from c3nav.editor.views.account import change_password_view, login_view, logout_view, register_view from c3nav.editor.views.changes import changeset_detail, changeset_edit, changeset_redirect from c3nav.editor.views.edit import edit, graph_edit, level_detail, list_objects, main_index, sourceimage, space_detail from c3nav.editor.views.overlays import overlays_list, overlay_features, overlay_feature_edit from c3nav.editor.views.users import user_detail, user_redirect -register_converter(EditPkConverter, 'editpk') - def add_editor_urls(model_name, parent_model_name=None, with_list=True, explicit_edit=False): model = apps.get_model('mapdata', model_name) @@ -17,7 +14,7 @@ def add_editor_urls(model_name, parent_model_name=None, with_list=True, explicit if parent_model_name: parent_model = apps.get_model('mapdata', parent_model_name) parent_model_name_plural = parent_model._meta.default_related_name - prefix = (parent_model_name_plural+r'//')+model_name_plural + prefix = (parent_model_name_plural+r'//')+model_name_plural else: prefix = model_name_plural @@ -29,7 +26,7 @@ def add_editor_urls(model_name, parent_model_name=None, with_list=True, explicit if with_list: result.append(path(prefix+'/', list_objects, name=name_prefix+'list', kwargs=kwargs)) result.extend([ - path(prefix+'//'+explicit_edit, edit, name=name_prefix+'edit', kwargs=kwargs), + path(prefix+'//'+explicit_edit, edit, name=name_prefix+'edit', kwargs=kwargs), path(prefix+'/create', edit, name=name_prefix+'create', kwargs=kwargs), ]) return result @@ -37,19 +34,20 @@ def add_editor_urls(model_name, parent_model_name=None, with_list=True, explicit # todo: custom path converters urlpatterns = [ - path('levels//', level_detail, name='editor.levels.detail'), - path('levels//spaces//', space_detail, name='editor.spaces.detail'), - path('levels//levels_on_top/create', edit, {'model': 'Level'}, + path('levels//', level_detail, name='editor.levels.detail'), + path('levels//spaces//', space_detail, name='editor.spaces.detail'), + path('levels//levels_on_top/create', edit, {'model': 'Level'}, name='editor.levels_on_top.create'), - path('levels//graph/', graph_edit, name='editor.levels.graph'), - path('spaces//graph/', graph_edit, name='editor.spaces.graph'), - path('levels//overlays/', overlays_list, name='editor.levels.overlays'), - path('levels//overlays//', overlay_features, name='editor.levels.overlay'), - path('levels//overlays//create', overlay_feature_edit, name='editor.levels.overlay.create'), - path('overlayfeatures/', overlay_feature_edit, name='editor.overlayfeatures.edit'), + path('levels//graph/', graph_edit, name='editor.levels.graph'), + path('spaces//graph/', graph_edit, name='editor.spaces.graph'), + path('levels//overlays/', overlays_list, name='editor.levels.overlays'), + path('levels//overlays//', overlay_features, name='editor.levels.overlay'), + path('levels//overlays//create', overlay_feature_edit, name='editor.levels.overlay.create'), + path('levels//overlays//features/', overlay_feature_edit, name='editor.levels.overlay.edit'), + path('overlayfeatures/', overlay_feature_edit, name='editor.overlayfeatures.edit'), path('changeset/', changeset_redirect, name='editor.changesets.current'), - path('changesets//', changeset_detail, name='editor.changesets.detail'), - path('changesets//edit', changeset_edit, name='editor.changesets.edit'), + path('changesets//', changeset_detail, name='editor.changesets.detail'), + path('changesets//edit', changeset_edit, name='editor.changesets.edit'), path('sourceimage/', sourceimage, name='editor.sourceimage'), path('user/', user_redirect, name='editor.users.redirect'), path('users//', user_detail, name='editor.users.detail'),