mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-24 16:21:53 +00:00
auto new year stuff
This commit is contained in:
parent
e1eb85969a
commit
d970942f04
@ -89,18 +89,37 @@ def alphabet_suffix(n):
|
|||||||
suffix = "_X_" + random.choice(string.ascii_lowercase) + random.choice(string.ascii_lowercase)
|
suffix = "_X_" + random.choice(string.ascii_lowercase) + random.choice(string.ascii_lowercase)
|
||||||
return suffix
|
return suffix
|
||||||
|
|
||||||
def current_expo():
|
def make_new_expo(year):
|
||||||
expos = Expedition.objects.all().order_by('-year')
|
|
||||||
if expos:
|
|
||||||
year = str(datetime.now(timezone.utc).year)
|
|
||||||
last_expo = expos[0].year
|
|
||||||
if last_expo != year: # create the expo object for the coming year, after Dec.31st
|
|
||||||
coUniqueAttribs = {"year": year}
|
coUniqueAttribs = {"year": year}
|
||||||
otherAttribs = {"name": f"CUCC expo {year}"}
|
otherAttribs = {"name": f"CUCC expo {year}"}
|
||||||
e = Expedition.objects.create(**otherAttribs, **coUniqueAttribs)
|
e = Expedition.objects.create(**otherAttribs, **coUniqueAttribs)
|
||||||
u = User.objects.get(username='expo')
|
u = User.objects.get(username='expo')
|
||||||
u.current_year = year
|
u.current_year = year
|
||||||
u.save()
|
u.save()
|
||||||
|
|
||||||
|
def make_new_expo_dir(year):
|
||||||
|
t = "<a href='index.html'>index</a><br><a href='mission.html'>mission</a><br><a href='logbook.html'>logbook</a><br>"
|
||||||
|
year_dir = Path(settings.EXPOWEB, 'years', year)
|
||||||
|
if not year_dir.is_dir():
|
||||||
|
year_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
for ff in ["index","logbook", "mission"]:
|
||||||
|
p = Path(year_dir, ff+".html")
|
||||||
|
if not p.is_file():
|
||||||
|
p.write_text(f"<html><head><title>{ff}</title></head><body><h1>{ff}</h1>{t}</body></html>")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def current_expo():
|
||||||
|
expos = Expedition.objects.all().order_by('-year')
|
||||||
|
if expos:
|
||||||
|
year = str(datetime.now(timezone.utc).year)
|
||||||
|
last_expo = expos[0].year
|
||||||
|
make_new_expo_dir(year)
|
||||||
|
if last_expo != year: # coming year, after Dec.31st
|
||||||
|
make_new_expo(year)
|
||||||
|
make_new_expo_dir(year)
|
||||||
|
|
||||||
# print(f"---{year}---")
|
# print(f"---{year}---")
|
||||||
return year
|
return year
|
||||||
else:
|
else:
|
||||||
|
@ -19,6 +19,7 @@ from troggle.core.models.caves import Cave, CaveAndEntrance, Entrance, GetCaveLo
|
|||||||
from troggle.core.models.logbooks import CaveSlug, QM
|
from troggle.core.models.logbooks import CaveSlug, QM
|
||||||
from troggle.core.models.wallets import Wallet
|
from troggle.core.models.wallets import Wallet
|
||||||
from troggle.core.utils import write_and_commit
|
from troggle.core.utils import write_and_commit
|
||||||
|
from troggle.core.utils import current_expo
|
||||||
from troggle.core.views import expo
|
from troggle.core.views import expo
|
||||||
from troggle.settings import CAVEDESCRIPTIONS, ENTRANCEDESCRIPTIONS
|
from troggle.settings import CAVEDESCRIPTIONS, ENTRANCEDESCRIPTIONS
|
||||||
from troggle.parsers.caves import read_cave, read_entrance
|
from troggle.parsers.caves import read_cave, read_entrance
|
||||||
@ -152,7 +153,7 @@ def caveindex(request):
|
|||||||
"caves1627": caves1627,
|
"caves1627": caves1627,
|
||||||
"caves1624": caves1624,
|
"caves1624": caves1624,
|
||||||
"notablecaves": getnotablecaves(),
|
"notablecaves": getnotablecaves(),
|
||||||
"cavepage": True},
|
"cavepage": True, "year": current_expo()},
|
||||||
)
|
)
|
||||||
|
|
||||||
def entranceindex(request):
|
def entranceindex(request):
|
||||||
@ -177,7 +178,7 @@ def cave3d(request, cave_id=""):
|
|||||||
except Cave.MultipleObjectsReturned:
|
except Cave.MultipleObjectsReturned:
|
||||||
# should really produce a better error message. This is a failure of ambiguous aliases probably.
|
# should really produce a better error message. This is a failure of ambiguous aliases probably.
|
||||||
caves = Cave.objects.filter(url=kpath)
|
caves = Cave.objects.filter(url=kpath)
|
||||||
return render(request, "svxcaveseveral.html", {"settings": settings, "caves": caves})
|
return render(request, "svxcaveseveral.html", {"settings": settings, "caves": caves, "year": current_expo()})
|
||||||
else:
|
else:
|
||||||
return file3d(request, cave, cave_id)
|
return file3d(request, cave, cave_id)
|
||||||
|
|
||||||
@ -297,6 +298,7 @@ def rendercave(request, cave, slug, cave_id=""):
|
|||||||
"svxstem": str(svxstem),
|
"svxstem": str(svxstem),
|
||||||
"svx3d": svx3d,
|
"svx3d": svx3d,
|
||||||
"wallets": wallets,
|
"wallets": wallets,
|
||||||
|
"year": current_expo()
|
||||||
}
|
}
|
||||||
|
|
||||||
# Do not catch any exceptions here: propagate up to caller
|
# Do not catch any exceptions here: propagate up to caller
|
||||||
@ -460,7 +462,7 @@ def edit_cave(request, path="", slug=None):
|
|||||||
{
|
{
|
||||||
"form": form,
|
"form": form,
|
||||||
"cave": cave,
|
"cave": cave,
|
||||||
"message": message,
|
"message": message, "year": current_expo(),
|
||||||
#"caveAndEntranceFormSet": ceFormSet,
|
#"caveAndEntranceFormSet": ceFormSet,
|
||||||
"path": path + "/", # used for saving images if attached
|
"path": path + "/", # used for saving images if attached
|
||||||
},
|
},
|
||||||
@ -652,7 +654,7 @@ def edit_entrance(request, path="", caveslug=None, entslug=None):
|
|||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
"editentrance.html",
|
"editentrance.html",
|
||||||
{
|
{ "year": current_expo(),
|
||||||
"entform": entform,
|
"entform": entform,
|
||||||
"cave": cave,
|
"cave": cave,
|
||||||
"ent": entrance,
|
"ent": entrance,
|
||||||
@ -670,7 +672,7 @@ def ent(request, cave_id, ent_letter):
|
|||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
"entrance.html",
|
"entrance.html",
|
||||||
{
|
{ "year": current_expo(),
|
||||||
"cave": cave,
|
"cave": cave,
|
||||||
"entrance": cave_and_ent.entrance,
|
"entrance": cave_and_ent.entrance,
|
||||||
"letter": cave_and_ent.entranceletter,
|
"letter": cave_and_ent.entranceletter,
|
||||||
@ -683,7 +685,7 @@ def cave_debug(request):
|
|||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
"cave_debug.html",
|
"cave_debug.html",
|
||||||
{"ents": ents, "caves": caves},
|
{"ents": ents, "caves": caves, "year": current_expo()},
|
||||||
)
|
)
|
||||||
|
|
||||||
def caveslist(request):
|
def caveslist(request):
|
||||||
@ -692,7 +694,7 @@ def caveslist(request):
|
|||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
"caveslist.html",
|
"caveslist.html",
|
||||||
{"caves": caves},
|
{"caves": caves, "year": current_expo()},
|
||||||
)
|
)
|
||||||
def get_entrances(request, caveslug):
|
def get_entrances(request, caveslug):
|
||||||
try:
|
try:
|
||||||
@ -700,7 +702,7 @@ def get_entrances(request, caveslug):
|
|||||||
except:
|
except:
|
||||||
return render(request, "errors/badslug.html", {"badslug": f"{caveslug} - from get_entrances()"})
|
return render(request, "errors/badslug.html", {"badslug": f"{caveslug} - from get_entrances()"})
|
||||||
return render(
|
return render(
|
||||||
request, "options.html", {"items": [(e.entrance.slug(), e.entrance.slug()) for e in cave.entrances()]}
|
request, "options.html", {"year": current_expo(), "items": [(e.entrance.slug(), e.entrance.slug()) for e in cave.entrances()]}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -717,9 +719,9 @@ def caveQMs(request, slug, open=False):
|
|||||||
if cave.non_public and settings.PUBLIC_SITE and not request.user.is_authenticated:
|
if cave.non_public and settings.PUBLIC_SITE and not request.user.is_authenticated:
|
||||||
return render(request, "nonpublic.html", {"instance": cave})
|
return render(request, "nonpublic.html", {"instance": cave})
|
||||||
elif open:
|
elif open:
|
||||||
return render(request, "cave_open_qms.html", {"cave": cave})
|
return render(request, "cave_open_qms.html", {"cave": cave, "year": current_expo()})
|
||||||
else:
|
else:
|
||||||
return render(request, "cave_qms.html", {"cave": cave})
|
return render(request, "cave_qms.html", {"cave": cave, "year": current_expo()})
|
||||||
|
|
||||||
|
|
||||||
def qm(request, cave_id, qm_id, year, grade=None, blockname=None):
|
def qm(request, cave_id, qm_id, year, grade=None, blockname=None):
|
||||||
@ -780,7 +782,7 @@ def qm(request, cave_id, qm_id, year, grade=None, blockname=None):
|
|||||||
qm,
|
qm,
|
||||||
f"{qmslug=}:{cave_id=} {year=} {qm_id=} {blockname=} {qm.expoyear=} {qm.completion_description=}",
|
f"{qmslug=}:{cave_id=} {year=} {qm_id=} {blockname=} {qm.expoyear=} {qm.completion_description=}",
|
||||||
)
|
)
|
||||||
return render(request, "qm.html", {"qm": qm})
|
return render(request, "qm.html", {"qm": qm, "year": current_expo()})
|
||||||
else:
|
else:
|
||||||
# raise
|
# raise
|
||||||
return render(
|
return render(
|
||||||
|
@ -9,7 +9,7 @@ from troggle.core.models.logbooks import LogbookEntry, PersonLogEntry, QM
|
|||||||
from troggle.core.models.survex import SurvexBlock, SurvexFile
|
from troggle.core.models.survex import SurvexBlock, SurvexFile
|
||||||
from troggle.core.models.troggle import Expedition, Person
|
from troggle.core.models.troggle import Expedition, Person
|
||||||
from troggle.core.models.wallets import Wallet
|
from troggle.core.models.wallets import Wallet
|
||||||
from troggle.core.utils import TROG
|
from troggle.core.utils import TROG, current_expo
|
||||||
from troggle.parsers.imports import import_logbook
|
from troggle.parsers.imports import import_logbook
|
||||||
|
|
||||||
|
|
||||||
@ -118,6 +118,7 @@ def expedition(request, expeditionname):
|
|||||||
personexpodays.append({"personexpedition": personexpedition, "personrow": prow})
|
personexpodays.append({"personexpedition": personexpedition, "personrow": prow})
|
||||||
|
|
||||||
ts[expeditionname] = {
|
ts[expeditionname] = {
|
||||||
|
"year": int(expeditionname),
|
||||||
"expedition": expo,
|
"expedition": expo,
|
||||||
"expeditions": expeditions,
|
"expeditions": expeditions,
|
||||||
"personexpodays": personexpodays,
|
"personexpodays": personexpodays,
|
||||||
|
@ -14,6 +14,7 @@ from troggle.core.views.expo import getmimetype
|
|||||||
from troggle.parsers.caves import add_cave_to_pending_list
|
from troggle.parsers.caves import add_cave_to_pending_list
|
||||||
from troggle.parsers.people import GetPersonExpeditionNameLookup
|
from troggle.parsers.people import GetPersonExpeditionNameLookup
|
||||||
from troggle.parsers.survex import set_walletdate
|
from troggle.parsers.survex import set_walletdate
|
||||||
|
from troggle.core.utils import current_expo
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -255,7 +256,7 @@ def walletslistperson(request, slug):
|
|||||||
request,
|
request,
|
||||||
"personwallets.html",
|
"personwallets.html",
|
||||||
{"manywallets": manywallets, "settings": settings, "person": p, "expeditions": expeditions,
|
{"manywallets": manywallets, "settings": settings, "person": p, "expeditions": expeditions,
|
||||||
"length_ug": length_ug}
|
"length_ug": length_ug, "year": current_expo()}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -330,7 +331,7 @@ def cavewallets(request, caveid):
|
|||||||
request,
|
request,
|
||||||
"cavewallets.html",
|
"cavewallets.html",
|
||||||
{"manywallets": manywallets, "settings": settings, "cave": cave, "expeditions": expeditions,
|
{"manywallets": manywallets, "settings": settings, "cave": cave, "expeditions": expeditions,
|
||||||
"length_ug": length_ug}
|
"length_ug": length_ug, "year": current_expo()}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -340,10 +341,10 @@ def oldwallet(request, path):
|
|||||||
print(f"! - oldwallet path:{path}")
|
print(f"! - oldwallet path:{path}")
|
||||||
try:
|
try:
|
||||||
wallet = Wallet.objects.get(walletname=urlunquote(path))
|
wallet = Wallet.objects.get(walletname=urlunquote(path))
|
||||||
return render(request, "wallet_old.html", {"wallet": wallet, "settings": settings})
|
return render(request, "wallet_old.html", {"wallet": wallet, "settings": settings, "year": current_expo()})
|
||||||
except:
|
except:
|
||||||
message = f"Scan folder error or not found '{path}' ."
|
message = f"Scan folder error or not found '{path}' ."
|
||||||
return render(request, "errors/generic.html", {"message": message})
|
return render(request, "errors/generic.html", {"message": message,"year": current_expo()})
|
||||||
|
|
||||||
|
|
||||||
def scansingle(request, path, file):
|
def scansingle(request, path, file):
|
||||||
@ -377,5 +378,5 @@ def allscans(request):
|
|||||||
# manywallets = Wallet.objects.all().prefetch_related('singlescan') fails as the link is defined on 'singlescan' not on 'wallet'
|
# manywallets = Wallet.objects.all().prefetch_related('singlescan') fails as the link is defined on 'singlescan' not on 'wallet'
|
||||||
expeditions = Expedition.objects.all()
|
expeditions = Expedition.objects.all()
|
||||||
return render(
|
return render(
|
||||||
request, "walletsall.html", {"manywallets": manywallets, "settings": settings, "expeditions": expeditions}
|
request, "walletsall.html", {"manywallets": manywallets, "settings": settings, "expeditions": expeditions, "year": current_expo()}
|
||||||
)
|
)
|
||||||
|
@ -11,6 +11,7 @@ from troggle.core.models.survex import SurvexStation, SurvexPersonRole
|
|||||||
from troggle.core.models.troggle import DataIssue, Expedition, Person, PersonExpedition
|
from troggle.core.models.troggle import DataIssue, Expedition, Person, PersonExpedition
|
||||||
from troggle.core.models.wallets import Wallet
|
from troggle.core.models.wallets import Wallet
|
||||||
from troggle.parsers.people import GetPersonExpeditionNameLookup, foreign_friends
|
from troggle.parsers.people import GetPersonExpeditionNameLookup, foreign_friends
|
||||||
|
from troggle.core.utils import current_expo
|
||||||
|
|
||||||
# from django.views.generic.list import ListView
|
# from django.views.generic.list import ListView
|
||||||
"""Very simple report pages summarizing data about the whole set of expeditions and of
|
"""Very simple report pages summarizing data about the whole set of expeditions and of
|
||||||
@ -65,13 +66,15 @@ def svxfilewild(request, year=None):
|
|||||||
for w in wallets:
|
for w in wallets:
|
||||||
for sb in w.survexblock_set.all():
|
for sb in w.survexblock_set.all():
|
||||||
walletslength += sb.legslength
|
walletslength += sb.legslength
|
||||||
|
if not year:
|
||||||
|
year = current_expo()
|
||||||
return render(request, "survexfilewild.html",
|
return render(request, "survexfilewild.html",
|
||||||
{"addupsurvexlength": addupsurvexlength / 1000,
|
{"addupsurvexlength": addupsurvexlength / 1000,
|
||||||
"legsbyexpo": legsbyexpo,
|
"legsbyexpo": legsbyexpo,
|
||||||
"nsurvexlegs": addupsurvexlegs,
|
"nsurvexlegs": addupsurvexlegs,
|
||||||
"walletslength": walletslength,
|
"walletslength": walletslength,
|
||||||
"wildlength": wildlength,
|
"wildlength": wildlength,
|
||||||
|
"year":year,
|
||||||
"svxwild": svxwild}
|
"svxwild": svxwild}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -97,7 +100,7 @@ def therionissues(request):
|
|||||||
for line in therionlog:
|
for line in therionlog:
|
||||||
line = line.replace("! Un-parsed image filename:", "")
|
line = line.replace("! Un-parsed image filename:", "")
|
||||||
newlog.append(line)
|
newlog.append(line)
|
||||||
return render(request, "therionreport.html", {"therionlog": newlog})
|
return render(request, "therionreport.html", {"therionlog": newlog, "year": current_expo()})
|
||||||
|
|
||||||
|
|
||||||
def surveximport(request):
|
def surveximport(request):
|
||||||
@ -110,7 +113,7 @@ def surveximport(request):
|
|||||||
contents = f.read()
|
contents = f.read()
|
||||||
else:
|
else:
|
||||||
print(f"{logpath} NOT FOUND {len(contents)}")
|
print(f"{logpath} NOT FOUND {len(contents)}")
|
||||||
return render(request, "survexreport.html", {"log": contents})
|
return render(request, "survexreport.html", {"log": contents, "year": current_expo()})
|
||||||
|
|
||||||
|
|
||||||
def survexdebug(request):
|
def survexdebug(request):
|
||||||
@ -123,7 +126,7 @@ def survexdebug(request):
|
|||||||
contents = f.read()
|
contents = f.read()
|
||||||
else:
|
else:
|
||||||
print(f"{logpath} NOT FOUND {len(contents)}")
|
print(f"{logpath} NOT FOUND {len(contents)}")
|
||||||
return render(request, "survexdebug.html", {"log": contents})
|
return render(request, "survexdebug.html", {"log": contents, "year": current_expo()})
|
||||||
|
|
||||||
|
|
||||||
def pathsreport(request):
|
def pathsreport(request):
|
||||||
@ -227,7 +230,7 @@ def pathsreport(request):
|
|||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
"pathsreport.html",
|
"pathsreport.html",
|
||||||
{"pathsdict": pathsdict, "bycodeslist": bycodeslist2, "bypathslist": bypathslist, "ncodes": ncodes},
|
{"pathsdict": pathsdict, "bycodeslist": bycodeslist2, "bypathslist": bypathslist, "ncodes": ncodes, "year": current_expo()},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -258,7 +261,7 @@ def stats(request):
|
|||||||
|
|
||||||
renderDict = {
|
renderDict = {
|
||||||
**statsDict,
|
**statsDict,
|
||||||
**{"addupsurvexlength": addupsurvexlength / 1000, "legsbyexpo": legsbyexpo, "nsurvexlegs": addupsurvexlegs},
|
**{"addupsurvexlength": addupsurvexlength / 1000, "legsbyexpo": legsbyexpo, "nsurvexlegs": addupsurvexlegs, "year": current_expo()},
|
||||||
} # new syntax
|
} # new syntax
|
||||||
return render(request, "statistics.html", renderDict)
|
return render(request, "statistics.html", renderDict)
|
||||||
|
|
||||||
@ -272,7 +275,7 @@ def dataissues(request):
|
|||||||
dilist = list(DataIssue.objects.all())
|
dilist = list(DataIssue.objects.all())
|
||||||
dilist.sort(key=myFunc)
|
dilist.sort(key=myFunc)
|
||||||
|
|
||||||
return render(request, "dataissues.html", {"didict": dilist})
|
return render(request, "dataissues.html", {"didict": dilist, "year": current_expo()})
|
||||||
|
|
||||||
|
|
||||||
def stations(request):
|
def stations(request):
|
||||||
@ -313,7 +316,7 @@ def stations(request):
|
|||||||
|
|
||||||
stations = SurvexStation.objects.all() # NB these are NOT all the stations in troggle_import_root.pos
|
stations = SurvexStation.objects.all() # NB these are NOT all the stations in troggle_import_root.pos
|
||||||
|
|
||||||
return render(request, "stations.html", {"ents": ents, "gpsents": gpsents, "stations": stations})
|
return render(request, "stations.html", {"ents": ents, "gpsents": gpsents, "stations": stations, "year": current_expo()})
|
||||||
|
|
||||||
|
|
||||||
def aliases(request, year):
|
def aliases(request, year):
|
||||||
|
@ -20,7 +20,7 @@ from troggle.core.models.logbooks import LogbookEntry
|
|||||||
from troggle.core.models.caves import Cave, GetCaveLookup
|
from troggle.core.models.caves import Cave, GetCaveLookup
|
||||||
from troggle.core.models.survex import SurvexFile, SurvexBlock #, SurvexDirectory
|
from troggle.core.models.survex import SurvexFile, SurvexBlock #, SurvexDirectory
|
||||||
from troggle.core.models.wallets import Wallet
|
from troggle.core.models.wallets import Wallet
|
||||||
from troggle.core.utils import only_commit
|
from troggle.core.utils import only_commit, current_expo
|
||||||
from troggle.parsers.survex import parse_one_file
|
from troggle.parsers.survex import parse_one_file
|
||||||
|
|
||||||
"""Everything that views survexfiles
|
"""Everything that views survexfiles
|
||||||
@ -389,6 +389,7 @@ def svx(request, survex_file):
|
|||||||
events = events_on_dates(svxblocks)
|
events = events_on_dates(svxblocks)
|
||||||
|
|
||||||
vmap = {
|
vmap = {
|
||||||
|
"year": current_expo(),
|
||||||
"settings": settings,
|
"settings": settings,
|
||||||
"warning": warning,
|
"warning": warning,
|
||||||
"has_3d": has_3d,
|
"has_3d": has_3d,
|
||||||
@ -641,6 +642,7 @@ def survexcaveslist(request):
|
|||||||
"onefilecaves": onefilecaves,
|
"onefilecaves": onefilecaves,
|
||||||
"multifilecaves": multifilecaves,
|
"multifilecaves": multifilecaves,
|
||||||
"subdircaves": subdircaves,
|
"subdircaves": subdircaves,
|
||||||
|
"year": current_expo(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -654,7 +656,7 @@ def survexdir(request):
|
|||||||
f.pathbad = True
|
f.pathbad = True
|
||||||
if Path(settings.SURVEX_DATA, f"{f.path}.svx").is_file():
|
if Path(settings.SURVEX_DATA, f"{f.path}.svx").is_file():
|
||||||
f.pathbad = False
|
f.pathbad = False
|
||||||
return render(request, "survexdir.html", {"survexfiles": survexfiles, "caves": caves})
|
return render(request, "survexdir.html", {"survexfiles": survexfiles, "caves": caves, "year": current_expo()})
|
||||||
|
|
||||||
def get_primaries(cave):
|
def get_primaries(cave):
|
||||||
sds = []
|
sds = []
|
||||||
@ -674,7 +676,7 @@ def survexcavesingle(request, cave_shortname):
|
|||||||
cave = Gcavelookup[cave_shortname]
|
cave = Gcavelookup[cave_shortname]
|
||||||
# print(f"survexcavesingle {cave_shortname=} => {cave=}")
|
# print(f"survexcavesingle {cave_shortname=} => {cave=}")
|
||||||
cave.sds = get_primaries(cave)
|
cave.sds = get_primaries(cave)
|
||||||
return render(request, "svxcaves.html", {"settings": settings, "caves": [cave]})
|
return render(request, "svxcaves.html", {"settings": settings, "caves": [cave], "year": current_expo()})
|
||||||
else:
|
else:
|
||||||
caves = Cave.objects.filter(kataster_number=cave_shortname)
|
caves = Cave.objects.filter(kataster_number=cave_shortname)
|
||||||
if len(caves) > 0:
|
if len(caves) > 0:
|
||||||
@ -682,9 +684,9 @@ def survexcavesingle(request, cave_shortname):
|
|||||||
for cave in caves:
|
for cave in caves:
|
||||||
cave.sds = get_primaries(cave)
|
cave.sds = get_primaries(cave)
|
||||||
# print(f"many {cave=} => {cave.sds=}")
|
# print(f"many {cave=} => {cave.sds=}")
|
||||||
return render(request, "svxcaves.html", {"settings": settings, "caves": caves})
|
return render(request, "svxcaves.html", {"settings": settings, "caves": caves, "year": current_expo()})
|
||||||
else:
|
else:
|
||||||
return render(request, "errors/svxcaves404.html", {"settings": settings, "cave": cave_shortname})
|
return render(request, "errors/svxcaves404.html", {"settings": settings, "cave": cave_shortname, "year": current_expo()})
|
||||||
|
|
||||||
def check_cave_registered(areacode, survex_cave):
|
def check_cave_registered(areacode, survex_cave):
|
||||||
"""Checks whether a cave has been properly registered when it is found in the Loser repo
|
"""Checks whether a cave has been properly registered when it is found in the Loser repo
|
||||||
|
0
index.html
Normal file
0
index.html
Normal file
Loading…
Reference in New Issue
Block a user