Skip to content

Commit

Permalink
'email_sent_for_modification' is readonly while tender is not published
Browse files Browse the repository at this point in the history
  • Loading branch information
chloend committed Dec 15, 2024
1 parent 7989719 commit 8956e6d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lemarche/tenders/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,9 @@ def get_readonly_fields(self, request, obj=None):
# slug cannot be changed once the tender is validated
if obj.status == tender_constants.STATUS_VALIDATED:
readonly_fields.append("slug")
# cannot edit 'email_sent_for_modification' while tender is not published
if obj and obj.email_sent_for_modification and obj.status != Tender.STATUS_PUBLISHED:
readonly_fields.append("email_sent_for_modification")
return readonly_fields

def save_model(self, request, obj: Tender, form, change):
Expand Down

0 comments on commit 8956e6d

Please sign in to comment.