diff --git a/core/models/logbooks.py b/core/models/logbooks.py index fd6bbfe..4ea740d 100644 --- a/core/models/logbooks.py +++ b/core/models/logbooks.py @@ -271,12 +271,16 @@ class QM(TroggleModel): def get_absolute_url(self): # This reverse resolution stuff is pure magic. Just change the regex in urls.py and everything changes to suit. Whacky. + if self.cave: + id = self.cave.slug() + else: + id = None return urljoin( settings.URL_ROOT, reverse( "qm", kwargs={ - "cave_id": self.cave.slug(), + "cave_id": id, "year": self.expoyear, "blockname": self.blockname, "qm_id": self.number,