diff --git a/parsers/survex.py b/parsers/survex.py index 8fc7e24..bd05010 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -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()