prospect and moving code to better places

This commit is contained in:
Philip Sargent
2021-04-17 01:41:06 +01:00
parent 4ad7033285
commit f8b613e0aa
6 changed files with 129 additions and 87 deletions

View File

@@ -354,7 +354,7 @@ def edit_cave(request, slug=None):
})
@login_required_if_public
def editEntrance(request, caveslug, slug=None):
def edit_entrance(request, caveslug=None, slug=None):
'''This is the form that edits the entrance data for a single entrance and writes out
an XML file in the :expoweb: repo folder
The format for the file being saved is in templates/dataformat/entrance.xml
@@ -362,7 +362,10 @@ def editEntrance(request, caveslug, slug=None):
It does save the data into into the database directly, not by parsing the file.
'''
message = ""
cave = Cave.objects.get(caveslug__slug = caveslug)
if caveslug is not None:
cave = Cave.objects.get(caveslug__slug = caveslug)
else:
cave = Cave()
if slug is not None:
entrance = Entrance.objects.get(entranceslug__slug = slug)
else: