diff options
Diffstat (limited to 'archaeological_finds/models_treatments.py')
-rw-r--r-- | archaeological_finds/models_treatments.py | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index 933df0fa8..60a4440fd 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -1304,6 +1304,21 @@ class TreatmentFile( exhibition_end_date = models.DateField( _("Exhibition end date"), blank=True, null=True ) + exhibition_location = models.ForeignKey( + Warehouse, + verbose_name=_("Exhibition location"), + blank=True, + null=True, + on_delete=models.SET_NULL, + ) + insurance_provider = models.ForeignKey( + Organization, + related_name="insurance_provider_of", + verbose_name=_("Insurance provider"), + on_delete=models.SET_NULL, + blank=True, + null=True, + ) comment = models.TextField(_("Comment"), blank=True, default="") documents = models.ManyToManyField( @@ -1457,6 +1472,12 @@ post_save.connect(cached_label_changed, sender=TreatmentFile) class ExhibitionType(GeneralType): + treatment_file_type = models.ForeignKey( + TreatmentFileType, + verbose_name=_("Treatment request type"), + on_delete=models.PROTECT, + ) + class Meta: verbose_name = _("Exhibition type") verbose_name_plural = _("Exhibition types") @@ -1474,11 +1495,11 @@ class Exhibition( AssociatedFindBasket, ): SLUG = "exhibition" - APP = "archaeological_finds" + APP = "archaeological-finds" MODEL = SLUG SHOW_URL = "show-exhibition" - DELETE_URL = "delete-exhibition" - TABLE_COLS = ["year", "reference", "name"] + # DELETE_URL = "delete-exhibition" + TABLE_COLS = ["year", "name", "reference"] BASE_SEARCH_VECTORS = [ SearchVectorConfig("exhibition_type__label"), SearchVectorConfig("reference"), @@ -1552,3 +1573,24 @@ class Exhibition( ] ADMIN_SECTION = _("Treatments") + def get_extra_actions(self, request): + """ + For sheet template: + """ + actions = super().get_extra_actions(request) + can_add_tf = self.can_do( + request, "archaeological_finds.add_treatmentfile" + ) + if can_add_tf: + + actions += [ + ( + reverse("exhibition-qa-add-loan", args=[self.pk]), + _("Add exhibition loan"), + "fa fa-plus", + _("exhibition loan"), + "", + True, + ), + ] + return actions |