fix download .3d file

This commit is contained in:
Philip Sargent 2023-03-21 12:56:51 +00:00
parent 4ae79a642e
commit 7caf1690c6
3 changed files with 17 additions and 11 deletions

View File

@ -94,7 +94,7 @@ class Cave(TroggleModel):
length = models.CharField(max_length=100, blank=True, null=True)
depth = models.CharField(max_length=100, blank=True, null=True)
extent = models.CharField(max_length=100, blank=True, null=True)
survex_file = models.CharField(max_length=100, blank=True, null=True)
survex_file = models.CharField(max_length=100, blank=True, null=True) # should be a foreign key
description_file = models.CharField(max_length=200, blank=True, null=True)
url = models.CharField(max_length=200, blank=True, null=True)
filename = models.CharField(max_length=200)
@ -109,6 +109,8 @@ class Cave(TroggleModel):
ordering = ("kataster_code", "unofficial_number")
def hassurvey(self):
"""This is almost certainly a fossil - needs checking...
"""
if not self.underground_centre_line:
return "No"
if (

View File

@ -480,17 +480,22 @@ div#scene {
<div id="Description">
{% comment %} The 'cave' object has text field, not forign-key fields, so we cant dereference to get info on the survex file
{% endcomment %}
<p>{% if cave.explorers %}
<h2>Explorers</h2>
{{ cave.explorers|safe }}
{% endif %}
<h2>Survex File(s)</h2>
All <a href="/survexfile/{{cave.kataster_number}}">survexfiles</a> for this cave<br />
All <a href="/survexfile/{{cave.kataster_number}}">survexfiles</a> for this cave {<br />
{% if cave.survex_file %}
Primary <a href="/survexfile/{{cave.survex_file}}">survex file</a> for this cave
<p>[<a href="https://aardgoose.github.io/CaveView.js/">CaveView</a> display of the .3d file is temporarily disabled while we fix things (Nov.2021).<br> See <a href="/handbook/computing/todo.rst">/handbook/computing/todo.rst</a>.]<br><br>
Download .3d file <a href="/cave/3d/{{cave}}">caves-{{ cave.area.all.0.kat_area }}/{{cave.kataster_number}}/{{svx3d}}.3d</a>
<br>
cave ID '{{cave.reference}}'<br>
cave survex path '{{ cave.area.all.0.kat_area }}/{{cave.kataster_number}}'
<div id='scene'></div>
{% endif %}
{% if cave.underground_description %}

View File

@ -48,14 +48,14 @@ Comment: '<span style="color:red;">{{qm.comment}}</span>'</a> <br />
<h4>QM original closest survey station</h4>
{% if qm.block %}
Survex block: {{qm.blockname}}
Survex block: <span style="font-family: monospace">{{qm.blockname}}</span>
<br>
{% endif %}
QM Nearest station: '{{qm.nearest_station_name}}' {{nearest_station_description}}<br />
QM page_ref: '{{qm.page_ref|safe}}'<br>
QM Nearest station: <span style="font-family: monospace">'{{qm.nearest_station_name}}' {{nearest_station_description}}</span><br />
QM Page reference: <span style="font-family: monospace">'<a href="/{{qm.cave.url_parent}}/{{qm.page_ref}}">{{qm.page_ref|safe}}</a>'</span><br>
<h4>QM original description</h4>
{{qm.location_description|safe}}
<div style="text-indent: 5%; font-family: monospace">{{qm.location_description|safe}}</div>
{% if qm.found_by %}
<h4>Creation</h4>
@ -64,11 +64,10 @@ Found by <a href="{{qm.found_by.get_absolute_url}}">{{qm.found_by}}</a> on {{qm.
{% if qm.cave %}
<h4>Cave: {{qm.cave|safe }}</h4>
{{ qm.cave|safe }} - <a href="{% url 'caveQMs' qm.cave|safe %}">All QMs </a> <br>
{{ qm.cave|safe }} - <a href="{% url 'caveQMs' qm.cave|safe %}">all QMs </a> for this cave <br>
{{ qm.cave|safe }} - <a href="/{{ qm.cave.url }}"> cave description </a> <br />
{{ qm.cave|safe }} - <a href="/survexfile/{{ qm.cave.kataster_number }}"> survexfiles </a> <br />
{{ qm.cave|safe }} - all <a href="/survexfile/{{qm.cave.kataster_number}}">survexfiles</a><br />
{{ qm.cave|safe }} - <a href="/survexfile/{{qm.cave.survex_file}}">primary survexfile</a>
{{ qm.cave|safe }} - all <a href="/survexfile/{{qm.cave.kataster_number}}">survexfiles</a> for this cave<br />
{{ qm.cave|safe }} - <a href="/survexfile/{{qm.cave.survex_file}}">primary survexfile</a> for this cave<br /><br />
{% endif %}
</div>