diff options
author | Martin Green <martin.speleo@gmail.com> | 2022-06-24 19:28:31 +0100 |
---|---|---|
committer | Martin Green <martin.speleo@gmail.com> | 2022-06-24 19:28:31 +0100 |
commit | 7db7c6706517e32f7186f5af50f431288e422686 (patch) | |
tree | 210af53c84cacb3adf60ec4ed0b56261c53b2682 /core/views/expo.py | |
parent | 54f47c58db254b14f1273ca9a24ea25df4d624cb (diff) | |
download | troggle-7db7c6706517e32f7186f5af50f431288e422686.tar.gz troggle-7db7c6706517e32f7186f5af50f431288e422686.tar.bz2 troggle-7db7c6706517e32f7186f5af50f431288e422686.zip |
Added link to parent cave in menu
Diffstat (limited to 'core/views/expo.py')
-rw-r--r-- | core/views/expo.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/core/views/expo.py b/core/views/expo.py index 330733e..05f9499 100644 --- a/core/views/expo.py +++ b/core/views/expo.py @@ -174,10 +174,17 @@ def expowebpage(request, expowebpath, path): menumatch = re.match(r'(.*)<ul id="links">', body, re.DOTALL + re.IGNORECASE) if menumatch: has_menu = True + + m = re.search(r"(162\d\/[^\/]+)[\/\.]", path, re.DOTALL + re.IGNORECASE) + if m: + path_start, = m.groups() + parent_caves = Cave.objects.filter(url__startswith = path_start) + else: + parent_caves = None handbook = path.startswith("handbook") return render(request, 'expopage.html', {'editable': editable, 'path': path, 'title': title, - 'body': body, 'homepage': (path == "index.htm"), 'has_menu': has_menu, 'handbook': handbook}) + 'body': body, 'homepage': (path == "index.htm"), 'has_menu': has_menu, 'handbook': handbook, 'parent_caves': parent_caves}) def mediapage(request, subpath=None, doc_root=None): '''This is for special prefix paths /photos/ /site_media/, /static/ etc. |