From 422d2324e892d0220f28d328d0d6830fa09c4825 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Tue, 6 Feb 2024 16:59:25 +0000 Subject: [PATCH] fix bad url in logbookentry --- core/models/caves.py | 23 ++++++----------------- templates/logbookentry.html | 2 +- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/core/models/caves.py b/core/models/caves.py index 0b11926..997bbdb 100644 --- a/core/models/caves.py +++ b/core/models/caves.py @@ -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) \ No newline at end of file + # never mind, make a duplicate + DataIssue.objects.create(parser=parsercode, message=message) \ No newline at end of file diff --git a/templates/logbookentry.html b/templates/logbookentry.html index e15cec3..3d1a49e 100644 --- a/templates/logbookentry.html +++ b/templates/logbookentry.html @@ -13,7 +13,7 @@

{% if logbookentry.cave %} -

place: {{logbookentry.place|safe}}

+

place: {{logbookentry.place|safe}}

{% else %}

{{logbookentry.place|safe}}

{% endif %}