mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 19:33:11 +00:00
Merge branch 'fix_payment_field_requirements' into 'master'
Les champs d'identification pour le paiement ne sont requis que lorsque le moyen de paiement est sélectionné. See merge request federez/re2o!100
This commit is contained in:
commit
b6247674da
3 changed files with 48 additions and 7 deletions
|
@ -143,6 +143,25 @@ class EditAssoOptionForm(ModelForm):
|
|||
self.fields['utilisateur_asso'].label = 'Compte utilisé pour\
|
||||
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):
|
||||
"""Formulaire d'edition des messages de bienvenue personnalisés"""
|
||||
|
|
20
preferences/migrations/0029_auto_20180318_1005.py
Normal file
20
preferences/migrations/0029_auto_20180318_1005.py
Normal 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),
|
||||
),
|
||||
]
|
|
@ -548,13 +548,15 @@ class AssoOption(PreferencesModel):
|
|||
('NONE', 'NONE'),
|
||||
('COMNPAY', 'COMNPAY'),
|
||||
)
|
||||
payment = models.CharField(max_length=255,
|
||||
payment = models.CharField(
|
||||
max_length=255,
|
||||
choices=PAYMENT,
|
||||
default='NONE',
|
||||
)
|
||||
payment_id = models.CharField(
|
||||
max_length=255,
|
||||
default='',
|
||||
blank=True
|
||||
)
|
||||
payment_pass = AESEncryptedField(
|
||||
max_length=255,
|
||||
|
|
Loading…
Reference in a new issue