From 5d7d2b82b2f47b748a589d946cc52a2e1e8f2893 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Tue, 5 Jul 2022 15:57:49 +0300 Subject: [PATCH] Fixing non-null error, even though it should be allowed --- core/models/caves.py | 4 ++-- parsers/caves.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/models/caves.py b/core/models/caves.py index 4e221e7..20e2d5b 100644 --- a/core/models/caves.py +++ b/core/models/caves.py @@ -71,8 +71,8 @@ def writetrogglefile(filepath, filecontent): class Area(TroggleModel): short_name = models.CharField(max_length=100) name = models.CharField(max_length=200, blank=True, null=True) - description = models.TextField(blank=True,null=True) - parent = models.ForeignKey('Area', blank=True, null=True,on_delete=models.SET_NULL) + description = models.TextField(blank=True, null=True) + parent = models.ForeignKey('Area', blank=True, null=True, on_delete=models.SET_NULL) def __str__(self): if self.parent: diff --git a/parsers/caves.py b/parsers/caves.py index 21f2b3f..6b73c13 100644 --- a/parsers/caves.py +++ b/parsers/caves.py @@ -149,9 +149,11 @@ def readcaves(): with transaction.atomic(): print(" - Deleting Caves and Entrances") + Area.objects.all().delete() Cave.objects.all().delete() Entrance.objects.all().delete() # Clear the cave data issues and the caves as we are reloading + DataIssue.objects.filter(parser='areas').delete() DataIssue.objects.filter(parser='caves').delete() DataIssue.objects.filter(parser='caves ok').delete() DataIssue.objects.filter(parser='entrances').delete()