From 2ff468efc4bf03b757ac8400d008b0eeb4c43649 Mon Sep 17 00:00:00 2001 From: Carlos Vega <carlos.vega@uni.lu> Date: Fri, 21 Jun 2019 14:57:05 +0200 Subject: [PATCH] make issue date field read only if the voucher is loaded on edit view --- smash/web/forms/voucher_forms.py | 1 + 1 file changed, 1 insertion(+) diff --git a/smash/web/forms/voucher_forms.py b/smash/web/forms/voucher_forms.py index 6c8e2f4c..926f45ba 100644 --- a/smash/web/forms/voucher_forms.py +++ b/smash/web/forms/voucher_forms.py @@ -80,6 +80,7 @@ class VoucherForm(ModelForm): self.fields['expiry_date'].required = False instance = getattr(self, 'instance', None) if instance and instance.pk: + self.fields['issue_date'].widget.attrs['readonly'] = True self.fields['voucher_type'].widget.attrs['readonly'] = True self.fields['hours'].widget.attrs['readonly'] = True self.fields['activity_type'].widget.attrs['readonly'] = True -- GitLab