From 7ecfb35925749eec5bbb35226c6dce16ce89f207 Mon Sep 17 00:00:00 2001 From: Jean-Romain Garnier Date: Sat, 7 Aug 2021 13:31:16 +0200 Subject: [PATCH] fix: Deposit creation form translations --- deposits/forms.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/deposits/forms.py b/deposits/forms.py index 9d919c44..8ce46c21 100644 --- a/deposits/forms.py +++ b/deposits/forms.py @@ -40,6 +40,11 @@ class DepositForm(FormRevMixin, ModelForm): user = kwargs.pop("user") super(DepositForm, self).__init__(*args, **kwargs) + # Set the fields' label to handle translation + self.fields["item"].label = _("Deposit item") + self.fields["payment_method"].label = _("Payment method") + self.fields["returned"].label = _("Deposit returned") + if creation: # During creation, we only need to select the item and payment # method, no need to add the "returned" checkbox @@ -47,8 +52,6 @@ class DepositForm(FormRevMixin, ModelForm): "item": self.fields["item"], "payment_method": self.fields["payment_method"], } - else: - self.fields["returned"].label = _("Deposit returned") class Meta: model = Deposit