mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-28 18:11:52 +00:00
removed fossil URL_ROOT from active code
This commit is contained in:
parent
c80db1a55f
commit
fd94909ee7
@ -118,13 +118,14 @@ class Cave(TroggleModel):
|
|||||||
# return f"{self.areacode}-{self.number()}"
|
# return f"{self.areacode}-{self.number()}"
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
|
# we do not use URL_ROOT any more.
|
||||||
if self.kataster_number:
|
if self.kataster_number:
|
||||||
pass
|
pass
|
||||||
elif self.unofficial_number:
|
elif self.unofficial_number:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
self.official_name.lower()
|
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):
|
def url_parent(self):
|
||||||
if self.url:
|
if self.url:
|
||||||
|
@ -70,7 +70,8 @@ class LogbookEntry(TroggleModel):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def get_absolute_url(self):
|
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):
|
def __str__(self):
|
||||||
return f"{self.date}: {self.title}"
|
return f"{self.date}: {self.title}"
|
||||||
|
@ -223,10 +223,8 @@ class SingleScan(models.Model):
|
|||||||
ordering = ("name",)
|
ordering = ("name",)
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return urljoin(
|
# we do not use URL_ROOT any more.
|
||||||
settings.URL_ROOT,
|
return reverse("scansingle", kwargs={"path": re.sub("#", "%23", self.wallet.walletname), "file": self.name})
|
||||||
reverse("scansingle", kwargs={"path": re.sub("#", "%23", self.wallet.walletname), "file": self.name}),
|
|
||||||
)
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "Scan Image: " + str(self.name) + " in " + str(self.wallet)
|
return "Scan Image: " + str(self.name) + " in " + str(self.wallet)
|
||||||
|
@ -25,7 +25,8 @@ class TroggleModel(models.Model):
|
|||||||
return self._meta.object_name
|
return self._meta.object_name
|
||||||
|
|
||||||
def get_admin_url(self):
|
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:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
@ -71,7 +72,8 @@ class Expedition(TroggleModel):
|
|||||||
get_latest_by = "year"
|
get_latest_by = "year"
|
||||||
|
|
||||||
def get_absolute_url(self):
|
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):
|
class Person(TroggleModel):
|
||||||
"""single Person, can go on many years"""
|
"""single Person, can go on many years"""
|
||||||
@ -89,9 +91,8 @@ class Person(TroggleModel):
|
|||||||
orderref = models.CharField(max_length=200) # for alphabetic
|
orderref = models.CharField(max_length=200) # for alphabetic
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return urljoin(
|
# we do not use URL_ROOT any more.
|
||||||
settings.URL_ROOT, reverse("person", kwargs={"first_name": self.first_name, "last_name": self.last_name})
|
return reverse("person", kwargs={"first_name": self.first_name, "last_name": self.last_name})
|
||||||
)
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name_plural = "People"
|
verbose_name_plural = "People"
|
||||||
@ -158,17 +159,15 @@ class PersonExpedition(TroggleModel):
|
|||||||
|
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return urljoin(
|
# we do not use URL_ROOT any more.
|
||||||
settings.URL_ROOT,
|
return reverse(
|
||||||
reverse(
|
|
||||||
"personexpedition",
|
"personexpedition",
|
||||||
kwargs={
|
kwargs={
|
||||||
"first_name": self.person.first_name,
|
"first_name": self.person.first_name,
|
||||||
"last_name": self.person.last_name,
|
"last_name": self.person.last_name,
|
||||||
"year": self.expedition.year,
|
"year": self.expedition.year,
|
||||||
},
|
},
|
||||||
),
|
)
|
||||||
)
|
|
||||||
|
|
||||||
def surveyedleglength(self):
|
def surveyedleglength(self):
|
||||||
"""Survey length for this person on all survex trips on this expedition"""
|
"""Survey length for this person on all survex trips on this expedition"""
|
||||||
|
@ -84,7 +84,8 @@ class Wallet(models.Model):
|
|||||||
ordering = ("walletname",)
|
ordering = ("walletname",)
|
||||||
|
|
||||||
def get_absolute_url(self):
|
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):
|
def get_json(self):
|
||||||
"""Read the JSON file for the wallet and do stuff
|
"""Read the JSON file for the wallet and do stuff
|
||||||
|
@ -187,6 +187,8 @@ def person(
|
|||||||
first_name="",
|
first_name="",
|
||||||
last_name="",
|
last_name="",
|
||||||
):
|
):
|
||||||
|
"""Original code as it has been for years. Trying to replace with better_person()
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
this_person = Person.objects.get(first_name=first_name, last_name=last_name)
|
this_person = Person.objects.get(first_name=first_name, last_name=last_name)
|
||||||
except:
|
except:
|
||||||
|
Loading…
Reference in New Issue
Block a user