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

Initial add of On This Day links to svx file page

This commit is contained in:
2023-02-26 22:13:37 +00:00
parent 394d94d5d6
commit 6de4fa66a2
9 changed files with 104 additions and 55 deletions

View File

@@ -1,6 +1,7 @@
import os
import re
from urllib.parse import urljoin
from pathlib import Path
from django.conf import settings
from django.db import models
@@ -39,8 +40,8 @@ class SurvexFile(models.Model):
# return "[SurvexFile:"+str(self.path) + "-" + str(self.survexdirectory) + "-" + str(self.cave)+"]"
def exists(self):
fname = os.path.join(settings.SURVEX_DATA, self.path + ".svx")
return os.path.isfile(fname)
fname = Path(settings.SURVEX_DATA, self.path + ".svx")
return fname.is_file()
def OpenFile(self):
fname = os.path.join(settings.SURVEX_DATA, self.path + ".svx")
@@ -64,6 +65,8 @@ class SurvexFile(models.Model):
class SurvexStationLookUpManager(models.Manager):
"""Don't know what this does,
https://docs.djangoproject.com/en/dev/topics/db/managers/"""
def lookup(self, name):
blocknames, sep, stationname = name.rpartition(".")
return self.get(block=SurvexBlock.objects.lookup(blocknames), name__iexact=stationname)
@@ -99,9 +102,8 @@ class SurvexStation(models.Model):
# Single SurvexBlock
#
class SurvexBlockLookUpManager(models.Manager):
"""Don't know what this does, suspect it is part of the Django admin
system"""
"""Don't know what this does,
https://docs.djangoproject.com/en/dev/topics/db/managers/ """
def lookup(self, name):
if name == "":
blocknames = []