8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-04 17:06:27 +00:00

Factorisation/héritage dans les models

This commit is contained in:
chirac 2016-07-05 11:51:29 +02:00
parent 9436331c26
commit 036c4fc774

View file

@ -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')