diff --git a/core/models/caves.py b/core/models/caves.py index 41a1b47..7deaca1 100644 --- a/core/models/caves.py +++ b/core/models/caves.py @@ -171,7 +171,8 @@ class Cave(TroggleModel): else: href = self.official_name.lower() #return settings.URL_ROOT + '/cave/' + href + '/' - return urljoin(settings.URL_ROOT, reverse('cave',kwargs={'cave_id':href,})) + #return urljoin(settings.URL_ROOT, reverse('cave',kwargs={'cave_id':href,})) # WRONG. This produces /cave/161 and should be /1623/161 + return Path(settings.URL_ROOT) / self.url # not good Django style.. NEEDS actual URL def __str__(self, sep = ": "): return str(self.slug()) diff --git a/urls.py b/urls.py index e3e5fa4..8527700 100644 --- a/urls.py +++ b/urls.py @@ -130,7 +130,7 @@ trogglepatterns = [ re_path(r'^cave/(?P[^/]+)/?$', caves.cave, name="cave"), #!!!BAD, local links fail.. to be checked.. re_path(r'^cave/(?P[^/]+)/?(?P[^/])$', ent), #!!!BAD, local links fail..# view_caves.ent re_path(r'^cave/(?P[^/]+)/edit/$', caves.edit_cave, name="edit_cave"), - re_path(r'^(?P\d\d\d\d)(?P.*)$', cavepage, name="cavepage"), # shorthand /1623/264 BUT url links break! Stop this.. + re_path(r'^(?P\d\d\d\d)(?P.*)$', cavepage, name="cavepage"), # shorthand /1623/264 # Note that urls eg '/1623/161/l/rl89a.htm' are handled by cavepage which redirects them to 'expopage' # Note that _edit$ for a cave description page in a subfolder e.g. /1623/204/204.html_edit gets caught here and breaks with 404