2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-15 03:17:12 +00:00

date handling now working for new wallet

This commit is contained in:
2023-02-01 19:10:46 +00:00
parent 8e51f3aff8
commit 587ccff501
3 changed files with 23 additions and 25 deletions

View File

@@ -13,6 +13,7 @@ from django.urls import reverse
# from troggle.core.models.survex import SurvexBlock
# from troggle.core.models.troggle import DataIssue # circular import. Hmm
YEAR_RANGE = (1975, 2050)
class Wallet(models.Model):
"""We do not keep the JSON values in the database, we query them afresh each time,
@@ -88,7 +89,8 @@ class Wallet(models.Model):
if self.walletname[4] != "#":
return None
year = int(self.walletname[0:4])
if year < 1975 or year > 2050:
ymin, ymax = YEAR_RANGE
if year < ymin or year > ymax:
return None
else:
self.walletyear = datetime.date(year, 1, 1)