diff --git a/lemarche/tenders/admin.py b/lemarche/tenders/admin.py index 90b2ce892..495d6a44d 100644 --- a/lemarche/tenders/admin.py +++ b/lemarche/tenders/admin.py @@ -546,6 +546,19 @@ class TenderAdmin(FieldsetsInlineMixin, admin.ModelAdmin): class Media: js = ["/static/js/admin_tender_confirmation.js"] + def get_object(self, request, object_id, from_field=None): + """ + Retrieve the object with the given primary key and optionally from a specific field. + + If the object is found, store its original 'email_sent_for_modification' and 'status' + values in private attributes for later comparison or use. + """ + obj = super().get_object(request, object_id, from_field) + if obj: + obj._original_email_sent_for_modification = obj.email_sent_for_modification + obj._original_status = obj.status + return obj + def get_queryset(self, request): qs = super().get_queryset(request) qs = qs.select_related("author")