diff options
Diffstat (limited to 'core/utils.py')
-rw-r--r-- | core/utils.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/core/utils.py b/core/utils.py index 6f07df9..8cd94e2 100644 --- a/core/utils.py +++ b/core/utils.py @@ -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""" |