forked from expo/troggle
Convert.format() to f-strings with flynt
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user