Clean up URL routes for row CRUD

This commit is contained in:
Lance Edgar 2022-08-05 12:09:32 -05:00
parent 9c31e92c01
commit 8776cd19dd

View file

@ -4870,7 +4870,8 @@ class MasterView(View):
# view row
if cls.has_rows:
if cls.rows_viewable:
config.add_route('{}.view_row'.format(route_prefix), '{}/{{uuid}}/rows/{{row_uuid}}'.format(url_prefix))
config.add_route('{}.view_row'.format(route_prefix),
'{}/rows/{{row_uuid}}'.format(instance_url_prefix))
config.add_view(cls, attr='view_row', route_name='{}.view_row'.format(route_prefix),
permission='{}.view'.format(permission_prefix))
@ -4880,7 +4881,8 @@ class MasterView(View):
config.add_tailbone_permission(permission_prefix, '{}.edit_row'.format(permission_prefix),
"Edit individual {}".format(row_model_title_plural))
if cls.rows_editable:
config.add_route('{}.edit_row'.format(route_prefix), '{}/{{uuid}}/rows/{{row_uuid}}/edit'.format(url_prefix))
config.add_route('{}.edit_row'.format(route_prefix),
'{}/rows/{{row_uuid}}/edit'.format(instance_url_prefix))
config.add_view(cls, attr='edit_row', route_name='{}.edit_row'.format(route_prefix),
permission='{}.edit_row'.format(permission_prefix))
@ -4889,6 +4891,7 @@ class MasterView(View):
if cls.rows_deletable:
config.add_tailbone_permission(permission_prefix, '{}.delete_row'.format(permission_prefix),
"Delete individual {}".format(row_model_title_plural))
config.add_route('{}.delete_row'.format(route_prefix), '{}/{{uuid}}/rows/{{row_uuid}}/delete'.format(url_prefix))
config.add_route('{}.delete_row'.format(route_prefix),
'{}/rows/{{row_uuid}}/delete'.format(instance_url_prefix))
config.add_view(cls, attr='delete_row', route_name='{}.delete_row'.format(route_prefix),
permission='{}.delete_row'.format(permission_prefix))