summaryrefslogtreecommitdiff
path: root/archaeological_finds/models_finds.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds/models_finds.py')
-rw-r--r--archaeological_finds/models_finds.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py
index 977a3ff3b..7e153c6b5 100644
--- a/archaeological_finds/models_finds.py
+++ b/archaeological_finds/models_finds.py
@@ -1175,7 +1175,7 @@ class Find(
("material_types__label", _("Material type")),
("object_types__label", _("Object type")),
("preservation_to_considers__label", _("Recommended treatments")),
- ("conservatory_state__label", _("Conservatory state")),
+ ("conservatory_states__label", _("Conservatory states")),
("integrities__label", _("Integrity")),
("remarkabilities__label", _("Remarkability")),
("communicabilities__label", _("Communicability")),
@@ -1343,9 +1343,9 @@ class Find(
pgettext_lazy("key for text search", "recommended-treatments"),
"preservation_to_considers__label__iexact",
),
- "conservatory_state": SearchAltName(
+ "conservatory_states": SearchAltName(
pgettext_lazy("key for text search", "conservatory"),
- "conservatory_state__label__iexact",
+ "conservatory_states__label__iexact",
),
"integrities": SearchAltName(
pgettext_lazy("key for text search", "integrity"),
@@ -1922,6 +1922,7 @@ class Find(
"technical_processes",
"datings",
"cultural_attributions",
+ "conservatory_states",
"object_types",
"functional_areas",
"technical_areas",
@@ -1947,6 +1948,7 @@ class Find(
"preservation_to_considers",
"alterations",
"alteration_causes",
+ "conservatory_states",
]
CACHED_LABELS = [
"cache_complete_museum_id",
@@ -1963,6 +1965,7 @@ class Find(
SERIALIZE_PROPERTIES = MainItem.SERIALIZE_PROPERTIES + [
"administrative_index",
"integrities_count",
+ "conservatory_states_count",
"remarkabilities_count",
"cultural_attributions_count",
"documents_count",
@@ -2218,12 +2221,10 @@ class Find(
museum_observed_quantity = models.PositiveSmallIntegerField(_("Observed quantity"), blank=True, null=True)
# preservation module
- conservatory_state = models.ForeignKey(
+ conservatory_states = models.ManyToManyField(
ConservatoryState,
- verbose_name=_("Conservatory state"),
+ verbose_name=_("Conservatory states"),
blank=True,
- null=True,
- on_delete=models.SET_NULL,
)
conservatory_comment = models.TextField(
_("Conservatory comment"), blank=True, default=""
@@ -2692,6 +2693,10 @@ class Find(
return self.integrities.count()
@property
+ def conservatory_states_count(self):
+ return self.conservatory_states.count()
+
+ @property
def remarkabilities_count(self):
return self.remarkabilities.count()