summaryrefslogtreecommitdiffstats
path: root/core/models
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2022-11-23 10:48:39 +0000
committerPhilip Sargent <philip.sargent@klebos.com>2022-11-23 10:48:39 +0000
commitb06d1dae4222cdb6e50fef629967bc76625b52e9 (patch)
tree5526634dc2d0c3097e27f611da23fcafd5197f32 /core/models
parent45a640dfe9aa5da411992668273e525ee6150b4b (diff)
downloadtroggle-b06d1dae4222cdb6e50fef629967bc76625b52e9.tar.gz
troggle-b06d1dae4222cdb6e50fef629967bc76625b52e9.tar.bz2
troggle-b06d1dae4222cdb6e50fef629967bc76625b52e9.zip
Convert.format() to f-strings with flynt
Diffstat (limited to 'core/models')
-rw-r--r--core/models/caves.py16
-rw-r--r--core/models/troggle.py12
2 files changed, 14 insertions, 14 deletions
diff --git a/core/models/caves.py b/core/models/caves.py
index 98b4832..30a4a0b 100644
--- a/core/models/caves.py
+++ b/core/models/caves.py
@@ -144,9 +144,9 @@ class Cave(TroggleModel):
def reference(self):
if self.kataster_number:
- return "%s-%s" % (self.kat_area(), self.kataster_number)
+ return f"{self.kat_area()}-{self.kataster_number}"
else:
- return "%s-%s" % (self.kat_area(), self.unofficial_number)
+ return f"{self.kat_area()}-{self.unofficial_number}"
def get_absolute_url(self):
if self.kataster_number:
@@ -332,21 +332,21 @@ class Entrance(TroggleModel):
if self.tag_station:
try:
s = SurvexStation.objects.lookup(self.tag_station)
- return r + "%0.0fE %0.0fN %0.0fAlt" % (s.x, s.y, s.z)
+ return r + f"{s.x:0.0f}E {s.y:0.0f}N {s.z:0.0f}Alt"
except:
- return r + "%s Tag Station not in dataset" % self.tag_station
+ return r + f"{self.tag_station} Tag Station not in dataset"
if self.exact_station:
try:
s = SurvexStation.objects.lookup(self.exact_station)
- return r + "%0.0fE %0.0fN %0.0fAlt" % (s.x, s.y, s.z)
+ return r + f"{s.x:0.0f}E {s.y:0.0f}N {s.z:0.0f}Alt"
except:
- return r + "%s Exact Station not in dataset" % self.tag_station
+ return r + f"{self.tag_station} Exact Station not in dataset"
if self.other_station:
try:
s = SurvexStation.objects.lookup(self.other_station)
- return r + "%0.0fE %0.0fN %0.0fAlt %s" % (s.x, s.y, s.z, self.other_description)
+ return r + f"{s.x:0.0f}E {s.y:0.0f}N {s.z:0.0f}Alt {self.other_description}"
except:
- return r + "%s Other Station not in dataset" % self.tag_station
+ return r + f"{self.tag_station} Other Station not in dataset"
if self.FINDABLE_CHOICES == "S":
r += "ERROR, Entrance has been surveyed but has no survex point"
if self.bearings:
diff --git a/core/models/troggle.py b/core/models/troggle.py
index 947ba21..b118d78 100644
--- a/core/models/troggle.py
+++ b/core/models/troggle.py
@@ -63,7 +63,7 @@ class DataIssue(TroggleModel):
ordering = ['date']
def __str__(self):
- return "%s - %s" % (self.parser, self.message)
+ return f"{self.parser} - {self.message}"
#
# single Expedition, usually seen by year
@@ -90,7 +90,7 @@ class Expedition(TroggleModel):
if len(expeditiondays) == 1:
return expeditiondays[0]
else:
- message ='! - more than one datum in an expeditionday: {}'.format(date)
+ message =f'! - more than one datum in an expeditionday: {date}'
DataIssue.objects.create(parser='expedition', message=message)
return expeditiondays[0]
res = ExpeditionDay(expedition=self, date=date)
@@ -139,7 +139,7 @@ class Person(TroggleModel):
def __str__(self):
if self.last_name:
- return "%s %s" % (self.first_name, self.last_name)
+ return f"{self.first_name} {self.last_name}"
return self.first_name
@@ -205,14 +205,14 @@ class PersonExpedition(TroggleModel):
#order_with_respect_to = 'expedition'
def __str__(self):
- return "%s: (%s)" % (self.person, self.expedition)
+ return f"{self.person}: ({self.expedition})"
#why is the below a function in personexpedition, rather than in person? - AC 14 Feb 09
def name(self):
if self.nickname:
- return "%s (%s) %s" % (self.person.first_name, self.nickname, self.person.last_name)
+ return f"{self.person.first_name} ({self.nickname}) {self.person.last_name}"
if self.person.last_name:
- return "%s %s" % (self.person.first_name, self.person.last_name)
+ return f"{self.person.first_name} {self.person.last_name}"
return self.person.first_name
def get_absolute_url(self):