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

more weirdness in circumventing MariaDB/Django misunderstandings

This commit is contained in:
Philip Sargent 2022-07-17 16:08:01 +03:00
parent b7035f1574
commit 145540caf5

View File

@ -1448,11 +1448,11 @@ def MakeSurvexFileRoot():
"""
# find a cave, any cave..
caves = Cave.objects.all()
smk = caves.filter(kataster_number="000")
smk = caves.filter(kataster_number="000") # returns a list, a QuerySet
fileroot = SurvexFile(path=settings.SURVEX_TOPNAME, cave=None)
fileroot.save()
directoryroot = SurvexDirectory(path=settings.SURVEX_DATA, cave=smk, primarysurvexfile=fileroot)
directoryroot = SurvexDirectory(path=settings.SURVEX_DATA, cave=smk[0], 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()