From a1c34f488daac73ad027f03f74a6c725a5ff53d9 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sun, 29 Jan 2023 18:17:43 +0000 Subject: [PATCH] bugfix from rearranged model files --- core/TESTS/test_imports.py | 6 +++--- core/models/caves.py | 1 + core/models/logbooks.py | 10 ++++------ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/core/TESTS/test_imports.py b/core/TESTS/test_imports.py index 40d0a5f..bc0c3ee 100644 --- a/core/TESTS/test_imports.py +++ b/core/TESTS/test_imports.py @@ -52,7 +52,7 @@ class SimpleTest(SimpleTestCase): def test_import_views_uploads(self): from troggle.core.views.uploads import dwgupload, scanupload def test_import_parsers_QMs(self): - from troggle.core.models.caves import QM, Cave, LogbookEntry + from troggle.core.models.logbooks import QM def test_import_parsers_people(self): from html import unescape @@ -62,7 +62,7 @@ class SimpleTest(SimpleTestCase): from django.utils.timezone import get_current_timezone, make_aware from parsers.people import GetPersonExpeditionNameLookup - from troggle.core.models.caves import Cave, LogbookEntry, PersonTrip + from troggle.core.models.logbooks import LogbookEntry, PersonTrip from troggle.core.models.troggle import DataIssue, Expedition def test_import_core_views_caves(self): from django.conf import settings @@ -73,7 +73,7 @@ class SimpleTest(SimpleTestCase): import troggle.core.views.expo from troggle.core.forms import (CaveAndEntranceFormSet, CaveForm, EntranceForm, EntranceLetterForm) - from troggle.core.models.caves import (QM, Area, Cave, CaveAndEntrance, + from troggle.core.models.caves import (Area, Cave, CaveAndEntrance, CaveSlug, Entrance, EntranceSlug, SurvexStation) from troggle.core.models.troggle import Expedition diff --git a/core/models/caves.py b/core/models/caves.py index bc2974e..af215a7 100644 --- a/core/models/caves.py +++ b/core/models/caves.py @@ -21,6 +21,7 @@ from django.template import Context, loader from django.urls import reverse import settings +from troggle.core.models.logbooks import QM from troggle.core.models.survex import SurvexStation from troggle.core.models.troggle import (DataIssue, Expedition, Person, TroggleModel) diff --git a/core/models/logbooks.py b/core/models/logbooks.py index da8d970..468b100 100644 --- a/core/models/logbooks.py +++ b/core/models/logbooks.py @@ -21,11 +21,9 @@ from django.template import Context, loader from django.urls import reverse import settings -from troggle.core.models.caves import (Area, Cave, CaveAndEntrance, - Entrance) from troggle.core.models.survex import SurvexStation from troggle.core.models.troggle import (DataIssue, Expedition, Person, - TroggleModel) + PersonExpedition, TroggleModel) '''The model declarations LogBookEntry, PersonTrip, QM ''' @@ -111,7 +109,7 @@ class QM(TroggleModel): """This is based on qm.csv in trunk/expoweb/1623/204 which has the fields: "Number","Grade","Area","Description","Page reference","Nearest station","Completion description","Comment" """ - cave = models.ForeignKey(Cave, related_name='QMs',blank=True, null=True,on_delete=models.SET_NULL ) + cave = models.ForeignKey('Cave', related_name='QMs',blank=True, null=True,on_delete=models.SET_NULL ) block = models.ForeignKey('SurvexBlock', null=True,on_delete=models.SET_NULL) # only for QMs from survex files blockname=models.TextField(blank=True,null=True) # NB truncated copy of survexblock name with last char added expoyear = models.CharField(max_length=4,blank=True, null=True) # could change to datetime if logbooks similarly chnaged @@ -130,7 +128,7 @@ class QM(TroggleModel): location_description = models.TextField(blank=True) nearest_station_description = models.CharField(max_length=400,blank=True, null=True) nearest_station_name = models.CharField(max_length=200,blank=True, null=True) - nearest_station = models.ForeignKey(SurvexStation,blank=True, null=True,on_delete=models.SET_NULL) + nearest_station = models.ForeignKey('SurvexStation',blank=True, null=True,on_delete=models.SET_NULL) area = models.CharField(max_length=100,blank=True, null=True) completion_description = models.TextField(blank=True,null=True) comment=models.TextField(blank=True,null=True) @@ -178,4 +176,4 @@ class QM(TroggleModel): def get_previous_by_id(self): return QM.objects.get(id=self.id-1) - + \ No newline at end of file