From 90918c040ef1c2c2676eb1e672a63ec40996d991 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Tue, 5 Jul 2016 11:51:29 +0200 Subject: [PATCH] =?UTF-8?q?Factorisation/h=C3=A9ritage=20dans=20les=20mode?= =?UTF-8?q?ls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cotisations/models.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/cotisations/models.py b/cotisations/models.py index d72ec60b..eec3b1e2 100644 --- a/cotisations/models.py +++ b/cotisations/models.py @@ -61,22 +61,16 @@ class NewFactureForm(ModelForm): class Meta: model = Facture - exclude = ['user', 'prix', 'name', 'valid'] + fields = ['paiement','banque','cheque','number'] + +class EditFactureForm(NewFactureForm): + class Meta(NewFactureForm.Meta): + fields = '__all__' -class EditFactureForm(ModelForm): def __init__(self, *args, **kwargs): super(EditFactureForm, self).__init__(*args, **kwargs) self.fields['user'].label = 'Adherent' - self.fields['number'].label = 'Quantité' - self.fields['cheque'].required = False - self.fields['banque'].required = False - self.fields['cheque'].label = 'Numero de chèque' self.fields['name'].label = 'Designation' self.fields['prix'].label = 'Prix unitaire' - self.fields['banque'].empty_label = "Non renseigné" - self.fields['paiement'].empty_label = "Séléctionner un moyen de paiement" self.fields['user'].empty_label = "Séléctionner l'adhérent propriétaire" - - class Meta: - model = Facture - fields = '__all__' + self.fields.pop('article')