diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2023-09-15 22:41:02 +0300 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2023-09-15 22:41:02 +0300 |
commit | 3390f17aa4b96827f2bdedf7eb4eab8773e7bfa6 (patch) | |
tree | 022eb32e7877eb67aced752fea4f8626512a348b | |
parent | 29879fdde29161b2a315488467bb934e45c94a6d (diff) | |
download | troggle-3390f17aa4b96827f2bdedf7eb4eab8773e7bfa6.tar.gz troggle-3390f17aa4b96827f2bdedf7eb4eab8773e7bfa6.tar.bz2 troggle-3390f17aa4b96827f2bdedf7eb4eab8773e7bfa6.zip |
.3d cave file links
-rw-r--r-- | core/views/caves.py | 13 | ||||
-rw-r--r-- | templates/cave.html | 6 |
2 files changed, 6 insertions, 13 deletions
diff --git a/core/views/caves.py b/core/views/caves.py index fa51263..ef234c1 100644 --- a/core/views/caves.py +++ b/core/views/caves.py @@ -146,26 +146,19 @@ def entranceindex(request): ) - def cave3d(request, cave_id=""): """This is used to create a download url in templates/cave.html if anyone wants to download the .3d file The caller template tries kataster first, then unofficial_number if that kataster number does not exist but only if Cave.survex_file is non-empty - - But the template file cave.html has its own ideas about the name of the file and thus the href. Ouch. - /cave/3d/<cave_id> """ try: cave = getCave(cave_id) except ObjectDoesNotExist: return HttpResponseNotFound except Cave.MultipleObjectsReturned: - # But only one might have survex data? So scan and return the first that works. - caves = getCaves(cave_id) - for c in caves: - if c.survex_file: - # exists, but may not be a valid file path to a valid .svx file in the Loser repo - return file3d(request, c, c.slug) + # should really produce a better error message. This is a failure of ambiguous aliases probably. + caves = Cave.objects.filter(url=kpath) + return render(request, "svxcaveseveral.html", {"settings": settings, "caves": caves}) else: return file3d(request, cave, cave_id) diff --git a/templates/cave.html b/templates/cave.html index 3a791da..c1a1c01 100644 --- a/templates/cave.html +++ b/templates/cave.html @@ -202,10 +202,10 @@ {% if cave.survex_file %} Primary <a href="/survexfile/{{cave.survex_file}}">survex file</a> for this cave <br> - Download .3d file <a href="{% url "cave3d" cave %}">caves-{{ cave.areacode }}/{% if cave.kataster_number %}{{cave.kataster_number}}{% else %}{{cave.unofficial_number}}{% endif %}/{{svx3d}}.3d</a> + Download .3d file <a href="{% url "cave3d" cave %}">{% url "cave3d" cave %}</a> <br> -cave ID '{{cave.reference}}'<br> -cave survex path '{{ cave.areacode }}/{% if cave.kataster_number %}{{cave.kataster_number}}{% else %}{{cave.unofficial_number}}{% endif %}' +cave reference '{{cave.reference}}'<br> +cave survex path '{{ cave.areacode }}/{% if cave.kataster_number %}{{cave.kataster_number}}{% else %}{{cave.unofficial_number}}{% endif %}/' <div id='scene'></div> {% endif %} {% endblock content %} |