2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-21 23:01:52 +00:00

fix bad url in logbookentry

This commit is contained in:
Philip Sargent 2024-02-06 16:59:25 +00:00
parent 957002507c
commit 422d2324e8
2 changed files with 7 additions and 18 deletions

View File

@ -132,7 +132,7 @@ class Cave(TroggleModel):
# pass
# else:
# self.official_name.lower()
return self.url # not good Django style? NEEDS actual URL
return "/"+ self.url # not good Django style? NEEDS actual URL
def url_parent(self):
if self.url:
@ -378,8 +378,9 @@ class Entrance(TroggleModel):
return self.findability != "S" or not self.has_photo or self.marking != "T"
def get_absolute_url(self):
# This can't be right..
res = "/".join((self.get_root().cave.get_absolute_url(), self.title))
return res
return self.url_parent()
def cavelist(self):
rs = []
@ -737,20 +738,8 @@ def update_dataissue(parsercode, message):
# bollocks, swallow this.DANGEROUS. Assuming this is the
# (1406, "Data too long for column 'message' at row1")
# fault in the mariaDb/Django setup.
exept_msg = f"Is this the (1406, Data too long for column 'message' at row1) problem?\nexception:{e}"
raise
except:
# Complete bollocks, but MariaDB barfs when it shouldn't : Django 3.2
issues = DataIssue.objects.filter(parser=parsercode, message=message)
print(f" # EXCEPTION looking for DataIssue '{parsercode}' {message})")
if len(issues) > 1:
print(f" # MULTIPLE DataIssues '{parsercode}' {message}")
for s in issues:
print(f" # {s.id=} DataIssues '{parsercode}' {message}") # .id is Django internal field, not one of ours
message = "#2 " + message
if len(issues) > 0:
i = issues[0]
i.message = message
i.save()
else:
DataIssue.objects.create(parser=parsercode, message=message)
# never mind, make a duplicate
DataIssue.objects.create(parser=parsercode, message=message)

View File

@ -13,7 +13,7 @@
</p>
{% if logbookentry.cave %}
<p>place: <a href="{{ logbookentry.cave.get_absolute_url }}">{{logbookentry.place|safe}}</p>
<p>place: <a href="{{ logbookentry.cave.get_absolute_url }}">{{logbookentry.place|safe}}</p>
{% else %}
<p>{{logbookentry.place|safe}}</p>
{% endif %}