summaryrefslogtreecommitdiff
path: root/archaeological_finds/models_treatments.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds/models_treatments.py')
-rw-r--r--archaeological_finds/models_treatments.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py
index cd82ab57e..77f66fae8 100644
--- a/archaeological_finds/models_treatments.py
+++ b/archaeological_finds/models_treatments.py
@@ -1808,7 +1808,7 @@ class StatementCondition(
width = models.FloatField(_("Width (cm)"), blank=True, null=True)
height = models.FloatField(_("Height (cm)"), blank=True, null=True)
volume = models.FloatField(_("Volume (l)"), blank=True, null=True)
- weight = models.FloatField(_("Weight"), blank=True, null=True)
+ weight = models.FloatField(_("Weight (g)"), blank=True, null=True)
diameter = models.FloatField(_("Diameter (cm)"), blank=True, null=True)
circumference = models.FloatField(_("Circumference (cm)"), blank=True, null=True)
thickness = models.FloatField(_("Thickness (cm)"), blank=True, null=True)
@@ -1824,6 +1824,21 @@ class StatementCondition(
dimensions_comment = models.TextField(
_("Dimensions comment"), blank=True, default=""
)
+ # documents
+ documents = models.ManyToManyField(
+ Document,
+ related_name="statement_conditions",
+ verbose_name=_("Documents"),
+ blank=True,
+ )
+ main_image = models.ForeignKey(
+ Document,
+ related_name="main_image_statement_conditions",
+ on_delete=models.SET_NULL,
+ verbose_name=_("Main image"),
+ blank=True,
+ null=True,
+ )
class Meta:
verbose_name = _("Statement of condition")
@@ -1834,6 +1849,19 @@ class StatementCondition(
]
ADMIN_SECTION = _("Treatments")
+ def __str__(self):
+ lbl = f"{self.date} - {self.statement_condition_type}"
+ if self.campaign_number:
+ lbl += f" [{self.campaign_number}]"
+ lbl += f" - {self.find}"
+ return lbl
+
+ def pk_str(self):
+ return str(self.pk)
+
+ def _get_base_image_path(self):
+ return f"{self.SLUG}/{self.date.year}"
+
@property
def is_last(self):
return not self.__class__.objects.filter(date__gt=self.date).exists()