forked from expo/troggle
If a cave is made with no entrances, redirect to a new entrance form for the cave
This commit is contained in:
parent
c7b3e8aff0
commit
2ee63a9804
@ -6,7 +6,7 @@ from pathlib import Path
|
||||
from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist
|
||||
from django.http import HttpResponse, HttpResponseNotFound, HttpResponseRedirect
|
||||
from django.shortcuts import render
|
||||
from django.urls import NoReverseMatch
|
||||
from django.urls import NoReverseMatch, reverse
|
||||
|
||||
import troggle.settings as settings
|
||||
from troggle.core.forms import CaveAndEntranceFormSet, CaveForm, EntranceForm, EntranceLetterForm
|
||||
@ -373,8 +373,10 @@ def edit_cave(request, path="", slug=None):
|
||||
except subprocess.SubprocessError:
|
||||
message = f"CANNOT git on server for this file {cave.filename}. Edits may not be committed.\nAsk a nerd to fix this."
|
||||
return render(request, "errors/generic.html", {"message": message})
|
||||
|
||||
if cave.entrances().count() > 0:
|
||||
return HttpResponseRedirect("/" + cave.url)
|
||||
else:
|
||||
return HttpResponseRedirect(reverse("newentrance", args = [cave.url_parent(), cave.slug()]))
|
||||
|
||||
else:
|
||||
if slug is not None:
|
||||
|
Loading…
Reference in New Issue
Block a user