mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-26 14:42:25 +00:00
Factorisation/héritage dans les models
This commit is contained in:
parent
a0f656b318
commit
90918c040e
1 changed files with 6 additions and 12 deletions
|
@ -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')
|
||||
|
|
Loading…
Reference in a new issue