mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 08:41:51 +00:00
allow editing ent letter if blank on many ent caves
This commit is contained in:
parent
bed663a031
commit
2c509d085e
@ -451,6 +451,8 @@ def edit_entrance(request, path="", caveslug=None, entslug=None):
|
||||
|
||||
if caveAndEntrance.entranceletter == "" and cave.entrances().count() > 0 :
|
||||
# this should not be blank on a multiple-entrance cave
|
||||
# but it doesn't trigger the entrnce letter form unless entletter has a value
|
||||
|
||||
entlettereditable = True
|
||||
|
||||
print(f"{entlettereditable=}")
|
||||
@ -497,22 +499,26 @@ def edit_entrance(request, path="", caveslug=None, entslug=None):
|
||||
|
||||
form = EntranceForm(instance=entrance)
|
||||
if entslug is None:
|
||||
entletter = EntranceLetterForm()
|
||||
print(f" Getting entletter from EntranceLetterForm")
|
||||
entletterform = EntranceLetterForm()
|
||||
# print(f" Getting entletter from EntranceLetterForm")
|
||||
else:
|
||||
entletter = caveAndEntrance.entranceletter
|
||||
print(f"{entletter=}")
|
||||
if entletter == "":
|
||||
entletterform = EntranceLetterForm()
|
||||
print(f" Blank value: getting entletter from EntranceLetterForm")
|
||||
print(f"{entletter=} {entletterform=}")
|
||||
else:
|
||||
form = EntranceForm()
|
||||
entletter = EntranceLetterForm()
|
||||
entform = EntranceForm()
|
||||
entletterform = EntranceLetterForm()
|
||||
|
||||
return render(
|
||||
request,
|
||||
"editentrance.html",
|
||||
{
|
||||
"form": form,
|
||||
"entform": form,
|
||||
"cave": cave,
|
||||
"entletter": entletter,
|
||||
"entletterform": entletterform,
|
||||
"entlettereditable": entlettereditable,
|
||||
"path": path + "/",
|
||||
},
|
||||
|
@ -18,11 +18,11 @@ so the Easting/Northing fields will be blank.
|
||||
</ul>
|
||||
|
||||
{% if entlettereditable %}
|
||||
<table>{{ entletter }}</table>
|
||||
<table>{{ entletterform }}</table>
|
||||
{% else %}
|
||||
<table><tr><th>Entrance Letter</th><td>{{ entletter }}</td></table>
|
||||
{% endif %}
|
||||
<table>{{ form }}</table>
|
||||
<table>{{ entform }}</table>
|
||||
<p><input type="submit" value="Submit" /></p>
|
||||
</form>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user