2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-25 08:41:51 +00:00

Allow user to see a caves edit link even if the user is not logged in. Such that they can be prompted to log in if required.

This commit is contained in:
Martin Green 2022-07-11 21:12:53 +01:00
parent 91c9cf0c31
commit c416de6e1e

View File

@ -230,13 +230,10 @@ def rendercave(request, cave, slug, cave_id=''):
# see design docum in troggle/templates/cave.html
# see rendercave() in troggle/core/views/caves.py
templatefile = 'cave.html'
if request.user.is_authenticated:
editable = True
else:
editable = False
if not cave_id:
cave_id = slug # cave.unofficial_number
context = {'cave_editable': editable, 'settings': settings, 'cave': cave, 'cavepage': True,
context = {'cave_editable': True, 'settings': settings, 'cave': cave, 'cavepage': True,
'cave_id': cave_id, 'svxstem': str(svxstem), 'svx3d':svx3d}
try:
r = render(request, templatefile, context) # crashes here with NoReverseMatch if url not set up for 'edit_cave' in urls.py