diff --git a/core/models/caves.py b/core/models/caves.py index 539006b..12bb0f9 100644 --- a/core/models/caves.py +++ b/core/models/caves.py @@ -118,13 +118,14 @@ class Cave(TroggleModel): # return f"{self.areacode}-{self.number()}" def get_absolute_url(self): + # we do not use URL_ROOT any more. if self.kataster_number: pass elif self.unofficial_number: pass else: self.official_name.lower() - return Path(settings.URL_ROOT) / 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: diff --git a/core/models/logbooks.py b/core/models/logbooks.py index 7aefa3f..4f29bb3 100644 --- a/core/models/logbooks.py +++ b/core/models/logbooks.py @@ -70,7 +70,8 @@ class LogbookEntry(TroggleModel): return True def get_absolute_url(self): - return urljoin(settings.URL_ROOT, reverse("logbookentry", kwargs={"date": self.date, "slug": self.slug})) + # we do not use URL_ROOT any more. + return reverse("logbookentry", kwargs={"date": self.date, "slug": self.slug}) def __str__(self): return f"{self.date}: {self.title}" diff --git a/core/models/survex.py b/core/models/survex.py index 1c6a1fe..542cfb8 100644 --- a/core/models/survex.py +++ b/core/models/survex.py @@ -223,10 +223,8 @@ class SingleScan(models.Model): ordering = ("name",) def get_absolute_url(self): - return urljoin( - settings.URL_ROOT, - reverse("scansingle", kwargs={"path": re.sub("#", "%23", self.wallet.walletname), "file": self.name}), - ) + # we do not use URL_ROOT any more. + return reverse("scansingle", kwargs={"path": re.sub("#", "%23", self.wallet.walletname), "file": self.name}) def __str__(self): return "Scan Image: " + str(self.name) + " in " + str(self.wallet) diff --git a/core/models/troggle.py b/core/models/troggle.py index 4a20afd..38850ee 100644 --- a/core/models/troggle.py +++ b/core/models/troggle.py @@ -25,7 +25,8 @@ class TroggleModel(models.Model): return self._meta.object_name def get_admin_url(self): - return urljoin(settings.URL_ROOT, "/admin/core/" + self.object_name().lower() + "/" + str(self.pk)) + # we do not use URL_ROOT any more. + return urljoin("/admin/core/" + self.object_name().lower() + "/" + str(self.pk)) class Meta: abstract = True @@ -71,7 +72,8 @@ class Expedition(TroggleModel): get_latest_by = "year" def get_absolute_url(self): - return urljoin(settings.URL_ROOT, reverse("expedition", args=[self.year])) + # we do not use URL_ROOT any more. + return reverse("expedition", args=[self.year]) class Person(TroggleModel): """single Person, can go on many years""" @@ -89,9 +91,8 @@ class Person(TroggleModel): orderref = models.CharField(max_length=200) # for alphabetic def get_absolute_url(self): - return urljoin( - settings.URL_ROOT, reverse("person", kwargs={"first_name": self.first_name, "last_name": self.last_name}) - ) + # we do not use URL_ROOT any more. + return reverse("person", kwargs={"first_name": self.first_name, "last_name": self.last_name}) class Meta: verbose_name_plural = "People" @@ -158,17 +159,15 @@ class PersonExpedition(TroggleModel): def get_absolute_url(self): - return urljoin( - settings.URL_ROOT, - reverse( + # we do not use URL_ROOT any more. + return reverse( "personexpedition", kwargs={ "first_name": self.person.first_name, "last_name": self.person.last_name, "year": self.expedition.year, }, - ), - ) + ) def surveyedleglength(self): """Survey length for this person on all survex trips on this expedition""" diff --git a/core/models/wallets.py b/core/models/wallets.py index f8662eb..9725a88 100644 --- a/core/models/wallets.py +++ b/core/models/wallets.py @@ -84,7 +84,8 @@ class Wallet(models.Model): ordering = ("walletname",) def get_absolute_url(self): - return urljoin(settings.URL_ROOT, reverse("singlewallet", kwargs={"path": re.sub("#", "%23", self.walletname)})) + # we do not use URL_ROOT any more. + return reverse("singlewallet", kwargs={"path": re.sub("#", "%23", self.walletname)}) def get_json(self): """Read the JSON file for the wallet and do stuff diff --git a/core/views/logbooks.py b/core/views/logbooks.py index 7f435b3..d9e2192 100644 --- a/core/views/logbooks.py +++ b/core/views/logbooks.py @@ -187,6 +187,8 @@ def person( first_name="", last_name="", ): + """Original code as it has been for years. Trying to replace with better_person() + """ try: this_person = Person.objects.get(first_name=first_name, last_name=last_name) except: