1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-28 05:32:37 +02:00

Add payment interface tests

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2024-02-24 23:05:21 +01:00
parent 2a2786ba6d
commit 207af441a0
5 changed files with 380 additions and 7 deletions

View File

@ -226,6 +226,9 @@ class PaymentAdminForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields["valid"].widget.choices[0] = ('unknown', _("Pending"))
payment_type = kwargs.get('data', {}).get('type', "")
self.fields['receipt'].required = payment_type in ["scholarship", "bank_transfer"]
self.fields['additional_information'].required = payment_type in ["other"]
def clean_receipt(self):
if "receipt" in self.files: