import os import re from collections import defaultdict from datetime import datetime, timezone from pathlib import Path from django.db import DataError, models from django.template import loader import settings from troggle.core.models.logbooks import QM from troggle.core.models.survex import SurvexStation, utmToLatLng from troggle.core.models.troggle import DataIssue, TroggleModel from troggle.core.utils import TROG, parse_aliases, writetrogglefile # Use the TROG global object to cache the cave lookup list. No good for multi-user.., or even multi-page. Pointless in fact. Gcavelookup = TROG["caves"]["gcavelookup"] Gcave_count = TROG["caves"]["gcavecount"] Gcavelookup = None Gcave_count = None """The model declarations for Areas, Caves and Entrances """ todo = """ - Why do we have CaveAndEntrance objects ? These do not need to be explcit for a many:many relationship these days now only used to create a