From 301fa1fce18a578fbef23a09a758dda0c6ba35a9 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Wed, 8 Mar 2023 18:02:00 +0000 Subject: [PATCH] re-enable lookup() on survexblock objects (again) --- core/models/survex.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/models/survex.py b/core/models/survex.py index 6c63034..6a0a357 100644 --- a/core/models/survex.py +++ b/core/models/survex.py @@ -82,7 +82,7 @@ class SurvexStationLookUpManager(models.Manager): class SurvexStation(models.Model): name = models.CharField(max_length=100) block = models.ForeignKey("SurvexBlock", null=True, on_delete=models.SET_NULL) - objects = SurvexStationLookUpManager() # overwrites SurvexStation.objects + objects = SurvexStationLookUpManager() # overwrites SurvexStation.objects and enables lookup() x = models.FloatField(blank=True, null=True) y = models.FloatField(blank=True, null=True) z = models.FloatField(blank=True, null=True) @@ -121,7 +121,7 @@ class SurvexBlockLookUpManager(models.Manager): blocknames = [] else: blocknames = name.split(".") - # block = SurvexBlock.objects.get(parent=None, survexfile__path=settings.SURVEX_TOPNAME) + block = SurvexBlock.objects.get(parent=None, survexfile__path=settings.SURVEX_TOPNAME) for blockname in blocknames: block = SurvexBlock.objects.get(parent=block, name__iexact=blockname) return block @@ -132,7 +132,7 @@ class SurvexBlock(models.Model): Multiple anonymous survex blocks are possible within the same surfex file """ - # objects = SurvexBlockLookUpManager() + objects = SurvexBlockLookUpManager() # overwrites SurvexBlock.objects and enables lookup() name = models.CharField(max_length=100) title = models.CharField(max_length=200) parent = models.ForeignKey("SurvexBlock", blank=True, null=True, on_delete=models.SET_NULL)