summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2021-04-14 00:11:59 +0100
committerPhilip Sargent <philip.sargent@klebos.com>2021-04-14 00:11:59 +0100
commitba0f5736181118f103b2c0bfadd8b04e464d553d (patch)
tree712da60543bfeb2d8ff767478a530fbaab8f1cc5
parent2f03f77ce487bbd68eead3a60008096245aeb859 (diff)
downloadtroggle-ba0f5736181118f103b2c0bfadd8b04e464d553d.tar.gz
troggle-ba0f5736181118f103b2c0bfadd8b04e464d553d.tar.bz2
troggle-ba0f5736181118f103b2c0bfadd8b04e464d553d.zip
restored cave edit capability
-rw-r--r--core/views/caves.py11
-rw-r--r--templates/menu.html2
2 files changed, 10 insertions, 3 deletions
diff --git a/core/views/caves.py b/core/views/caves.py
index b4c2932..c0576c6 100644
--- a/core/views/caves.py
+++ b/core/views/caves.py
@@ -251,12 +251,19 @@ def rendercave(request, cave, slug, cave_id=''):
else:
svxstem = Path(cave.survex_file).parent / Path(cave.survex_file).stem
svx3d = Path(cave.survex_file).stem
+
# NOTE the template itself loads the 3d file using javascript before it loads anything else.
# Django cannot see what this javascript is doing, so we need to ensure that the 3d file exists first.
# run this just for the side-effect of generating the 3d file? Nope, crashes.
- # TO DO - restructure this so that the regeneration is callable form here.
+ # TO DO - restructure this so that the regeneration is callable from here.
#discard_response = cave3d(request, cave_id=cave_id)
- return render(request,'cave.html', {'settings': settings, 'cave': cave, 'cavepage': True,
+
+ if request.user.is_authenticated:
+ editable = True
+ else:
+ editable = False
+ print(" ! rendercave:'{}' svxstem:{} svx3d:'{}'".format(cave, svxstem, svx3d))
+ return render(request,'cave.html', {'cave_editable': editable, 'settings': settings, 'cave': cave, 'cavepage': True,
'cave_id': cave_id, 'svxstem': svxstem, 'svx3d':svx3d})
def cavepage(request, karea, subpath):
diff --git a/templates/menu.html b/templates/menu.html
index f9fdf4c..45d57b5 100644
--- a/templates/menu.html
+++ b/templates/menu.html
@@ -12,6 +12,6 @@
<input id="omega-autofocus" type=search name=P value="testing" size=8 autofocus>
<input type=submit value="Search"></li>
{% if editable %}<li><a href="{% url "editexpopage" path %}" class="editlink"><strong>Edit this page</strong></a></li>{% endif %}
-{% if cave_editable %}<li><a href="{% url "edit_cave" cave_editable %}" class="editlink"><strong>Edit this cave</strong></a></li>{% endif %}
+{% if cave_editable %}<li><a href="{% url "edit_cave" cave.slug %}" class="editlink"><strong>Edit this cave</strong></a></li>{% endif %}
</ul>
{% endif %}