summaryrefslogtreecommitdiff
path: root/archaeological_finds/models_finds.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2024-03-01 18:15:10 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2024-04-16 16:43:02 +0200
commit6d796bab7ddb2d3f07ef13dec32b2b8c256f90b3 (patch)
tree9030233c2c810350378c9277235825c4f59fb975 /archaeological_finds/models_finds.py
parent337ae3b6e9dfdd25543f7b816e9e444619910393 (diff)
downloadIshtar-6d796bab7ddb2d3f07ef13dec32b2b8c256f90b3.tar.bz2
Ishtar-6d796bab7ddb2d3f07ef13dec32b2b8c256f90b3.zip
🐛 Find - fix m2m edtion of museum fields
Diffstat (limited to 'archaeological_finds/models_finds.py')
-rw-r--r--archaeological_finds/models_finds.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py
index 8a28cc272..4eabda174 100644
--- a/archaeological_finds/models_finds.py
+++ b/archaeological_finds/models_finds.py
@@ -2351,10 +2351,11 @@ class Find(
def has_museum_section(self):
if get_current_profile().museum and self.mark:
return True
- for field in self._meta.fields:
+ for field in self._meta.get_fields():
if not field.name.startswith("museum_"):
continue
- if getattr(self, field.name):
+ instanced_field = getattr(self, field.name)
+ if instanced_field and (not field.many_to_many or instanced_field.count()):
return True
return False