mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +00:00
Allow QMS to be rendered to a string, if the case that an optional parameter is missing
This commit is contained in:
parent
c416de6e1e
commit
5582d545a1
@ -505,9 +505,22 @@ class QM(TroggleModel):
|
||||
return f'{self.code()}'
|
||||
|
||||
def code(self):
|
||||
return f'{str(self.cave.slug())[5:]}-{self.expoyear}-{self.blockname}{self.number}{self.grade}'
|
||||
if self.cave:
|
||||
cavestr = str(self.cave.slug())[5:]
|
||||
else:
|
||||
cavestr = ""
|
||||
if self.expoyear:
|
||||
expoyearstr = str(self.cave.slug())[5:]
|
||||
else:
|
||||
expoyearstr = self.expoyear
|
||||
if self.blockname:
|
||||
blocknamestr = self.blockname
|
||||
else:
|
||||
blocknamestr = ""
|
||||
return f'{cavestr}-{expoyearstr}-{blocknamestr}{self.number}{self.grade}'
|
||||
|
||||
def newslug(self):
|
||||
|
||||
qmslug = f'{str(self.cave)}-{self.expoyear}-{self.blockname}{self.number}{self.grade}'
|
||||
return qmslug
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user