8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-27 07:02:26 +00:00

Les champs d'identification pour le paiement ne sont requis que lorsque le moyen de paiement est activé.

This commit is contained in:
Hugo LEVY-FALK 2018-03-18 10:10:56 +01:00
parent 8ce44ee2af
commit 53ea7e08bb
3 changed files with 48 additions and 7 deletions

View file

@ -143,6 +143,25 @@ class EditAssoOptionForm(ModelForm):
self.fields['utilisateur_asso'].label = 'Compte utilisé pour\ self.fields['utilisateur_asso'].label = 'Compte utilisé pour\
faire les modifications depuis /admin' faire les modifications depuis /admin'
def clean(self):
cleaned_data = super().clean()
payment = cleaned_data.get('payment')
if payment == 'NONE':
return cleaned_data
if not cleaned_data.get('payment_id', ''):
msg = forms.ValidationError("Vous devez spécifier un identifiant \
de paiement.")
self.add_error('payment_id', msg)
if not cleaned_data.get('payment_pass', ''):
msg = forms.ValidationError("Vous devez spécifier un mot de passe \
de paiement.")
self.add_error('payment_pass', msg)
return cleaned_data
class EditMailMessageOptionForm(ModelForm): class EditMailMessageOptionForm(ModelForm):
"""Formulaire d'edition des messages de bienvenue personnalisés""" """Formulaire d'edition des messages de bienvenue personnalisés"""

View file

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-03-18 09:05
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('preferences', '0028_assooption_description'),
]
operations = [
migrations.AlterField(
model_name='assooption',
name='payment_id',
field=models.CharField(blank=True, default='', max_length=255),
),
]

View file

@ -548,13 +548,15 @@ class AssoOption(PreferencesModel):
('NONE', 'NONE'), ('NONE', 'NONE'),
('COMNPAY', 'COMNPAY'), ('COMNPAY', 'COMNPAY'),
) )
payment = models.CharField(max_length=255, payment = models.CharField(
max_length=255,
choices=PAYMENT, choices=PAYMENT,
default='NONE', default='NONE',
) )
payment_id = models.CharField( payment_id = models.CharField(
max_length=255, max_length=255,
default='', default='',
blank=True
) )
payment_pass = AESEncryptedField( payment_pass = AESEncryptedField(
max_length=255, max_length=255,