forked from DGNum/gestioCOF
Py3 allows to shorten super()
This commit is contained in:
parent
5a5b60ec4d
commit
42e762bc4a
11 changed files with 57 additions and 57 deletions
|
@ -42,7 +42,7 @@ class AccountForm(forms.ModelForm):
|
|||
|
||||
# Surcharge pour passer data à Account.save()
|
||||
def save(self, data = {}, *args, **kwargs):
|
||||
obj = super(AccountForm, self).save(commit = False, *args, **kwargs)
|
||||
obj = super().save(commit = False, *args, **kwargs)
|
||||
obj.save(data = data)
|
||||
return obj
|
||||
|
||||
|
@ -91,7 +91,7 @@ class AccountPwdForm(forms.Form):
|
|||
raise ValidationError("Mot de passe trop court")
|
||||
if pwd1 != pwd2:
|
||||
raise ValidationError("Les mots de passes sont différents")
|
||||
super(AccountPwdForm, self).clean()
|
||||
super().clean()
|
||||
|
||||
class CofForm(forms.ModelForm):
|
||||
def clean_is_cof(self):
|
||||
|
@ -195,7 +195,7 @@ class CheckoutStatementCreateForm(forms.ModelForm):
|
|||
or self.cleaned_data['balance_200'] is None
|
||||
or self.cleaned_data['balance_500'] is None):
|
||||
raise ValidationError("Y'a un problème. Si tu comptes la caisse, mets au moins des 0 stp (et t'as pas idée de comment c'est long de vérifier que t'as mis des valeurs de partout...)")
|
||||
super(CheckoutStatementCreateForm, self).clean()
|
||||
super().clean()
|
||||
|
||||
class CheckoutStatementUpdateForm(forms.ModelForm):
|
||||
class Meta:
|
||||
|
@ -236,7 +236,7 @@ class ArticleForm(forms.ModelForm):
|
|||
required = False)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(ArticleForm, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
if self.instance.pk:
|
||||
self.initial['suppliers'] = self.instance.suppliers.values_list('pk', flat=True)
|
||||
|
||||
|
@ -250,7 +250,7 @@ class ArticleForm(forms.ModelForm):
|
|||
category, _ = ArticleCategory.objects.get_or_create(name=category_new)
|
||||
self.cleaned_data['category'] = category
|
||||
|
||||
super(ArticleForm, self).clean()
|
||||
super().clean()
|
||||
|
||||
class Meta:
|
||||
model = Article
|
||||
|
@ -321,7 +321,7 @@ class KPsulOperationForm(forms.ModelForm):
|
|||
}
|
||||
|
||||
def clean(self):
|
||||
super(KPsulOperationForm, self).clean()
|
||||
super().clean()
|
||||
type_ope = self.cleaned_data.get('type')
|
||||
amount = self.cleaned_data.get('amount')
|
||||
article = self.cleaned_data.get('article')
|
||||
|
@ -364,7 +364,7 @@ class AddcostForm(forms.Form):
|
|||
raise ValidationError('Compte invalide')
|
||||
else:
|
||||
self.cleaned_data['amount'] = 0
|
||||
super(AddcostForm, self).clean()
|
||||
super().clean()
|
||||
|
||||
|
||||
# -----
|
||||
|
@ -462,7 +462,7 @@ class InventoryArticleForm(forms.Form):
|
|||
stock_new = forms.IntegerField(required=False)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(InventoryArticleForm, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
if 'initial' in kwargs:
|
||||
self.name = kwargs['initial']['name']
|
||||
self.stock_old = kwargs['initial']['stock_old']
|
||||
|
@ -484,7 +484,7 @@ class OrderArticleForm(forms.Form):
|
|||
quantity_ordered = forms.IntegerField(required=False)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(OrderArticleForm, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
if 'initial' in kwargs:
|
||||
self.name = kwargs['initial']['name']
|
||||
self.stock = kwargs['initial']['stock']
|
||||
|
@ -514,7 +514,7 @@ class OrderArticleToInventoryForm(forms.Form):
|
|||
quantity_received = forms.IntegerField()
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(OrderArticleToInventoryForm, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
if 'initial' in kwargs:
|
||||
self.name = kwargs['initial']['name']
|
||||
self.category = kwargs['initial']['category']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue