From 8759af6fb2a66868fd853042369551aaeb1907c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Valenta?= <git@imaniti.org> Date: Sun, 2 Jul 2023 18:04:00 +0900 Subject: [PATCH] run hooks --- contracts/forms.py | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/contracts/forms.py b/contracts/forms.py index 3f9b300..c4c9133 100644 --- a/contracts/forms.py +++ b/contracts/forms.py @@ -34,34 +34,54 @@ class ContractAdminForm(forms.ModelForm): if self.instance.id is None: if choice_key in ( Contract.StatusTypes.WORK_IN_PROGRESS, - Contract.StatusTypes.TO_BE_APPROVED + Contract.StatusTypes.TO_BE_APPROVED, ): - allowed_choices.append((choice_key, choice_label,)) + allowed_choices.append( + ( + choice_key, + choice_label, + ) + ) continue if self.instance.status == choice_key: - allowed_choices.append((choice_key, choice_label,)) + allowed_choices.append( + ( + choice_key, + choice_label, + ) + ) continue if self.instance.status in ( Contract.StatusTypes.WORK_IN_PROGRESS, - Contract.StatusTypes.TO_BE_APPROVED + Contract.StatusTypes.TO_BE_APPROVED, ): if self.current_user.has_perm("contract.approve"): if choice_key in ( Contract.StatusTypes.APPROVED, - Contract.StatusTypes.REJECTED + Contract.StatusTypes.REJECTED, ): - allowed_choices.append((choice_key, choice_label,)) + allowed_choices.append( + ( + choice_key, + choice_label, + ) + ) continue if self.instance.status == Contract.StatusTypes.REJECTED: if choice_key in ( Contract.StatusTypes.WORK_IN_PROGRESS, - Contract.StatusTypes.TO_BE_APPROVED + Contract.StatusTypes.TO_BE_APPROVED, ): - allowed_choices.append((choice_key, choice_label,)) + allowed_choices.append( + ( + choice_key, + choice_label, + ) + ) continue self.fields["status"].widget = forms.Select(choices=allowed_choices) @@ -75,11 +95,7 @@ class ContractAdminForm(forms.ModelForm): == self.instance.StatusTypes.REJECTED ): raise ValidationError( - { - "status": ( - "Smlouvu nelze upravovat, zatímco je zamítnutá." - ) - } + {"status": ("Smlouvu nelze upravovat, zatímco je zamítnutá.")} ) if ( -- GitLab