2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-14 19:47:12 +00:00

validate year in logbook entry form

This commit is contained in:
2023-09-05 17:19:09 +03:00
parent 220e1327d7
commit 8e2990ca7a
3 changed files with 44 additions and 33 deletions

View File

@@ -8,6 +8,8 @@ import subprocess
from decimal import getcontext
from pathlib import Path
from troggle.core.models.troggle import Expedition
getcontext().prec = 2 # use 2 significant figures for decimal calculations
import settings
@@ -73,7 +75,14 @@ def alphabet_suffix(n):
suffix = alphabet[n-1]
else:
suffix = "_X_" + random.choice(string.ascii_lowercase) + random.choice(string.ascii_lowercase)
return suffix
return suffix
def current_expo():
expos = Expedition.objects.all().order_by('-year')
if expos:
return expos[0].year
else:
return "1970"
def only_commit(fname, message):
"""Only used to commit a survex file edited and saved in view/survex.py"""