2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

cleaner zeroth cave setting

This commit is contained in:
Philip Sargent 2022-07-15 16:44:02 +03:00
parent 73e9ae54fa
commit 8aab01c126

View File

@ -1447,11 +1447,12 @@ def MakeSurvexFileRoot():
"""Returns a file_object.path = SURVEX_TOPNAME associated with directory_object.path = SURVEX_DATA
"""
# find a cave, any cave..
c = Cave.objects.all()
caves = Cave.objects.all()
smk = caves.filter(kataster_number="000")
fileroot = SurvexFile(path=settings.SURVEX_TOPNAME, cave=None)
fileroot.save()
directoryroot = SurvexDirectory(path=settings.SURVEX_DATA, cave=c[0], primarysurvexfile=fileroot)
directoryroot = SurvexDirectory(path=settings.SURVEX_DATA, cave=smk, primarysurvexfile=fileroot)
# MariaDB doesn't like this hack. Complains about non-null cave_id EVEN THOUGH our model file says this is OK:
# cave = models.ForeignKey('Cave', blank=True, null=True,on_delete=models.SET_NULL)
directoryroot.save()