mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-22 15:51:19 +00:00
Fix error on accounting when no target_type specified
This commit is contained in:
parent
7cb9ea40ac
commit
2ef3c0260a
@ -304,14 +304,15 @@ class OperationForm(forms.ModelForm):
|
||||
|
||||
def clean(self):
|
||||
self.cleaned_data = super(OperationForm, self).clean()
|
||||
if self.cleaned_data['target_type'] == "USER":
|
||||
self.cleaned_data['target_id'] = self.cleaned_data['user'].id
|
||||
elif self.cleaned_data['target_type'] == "ACCOUNT":
|
||||
self.cleaned_data['target_id'] = self.cleaned_data['club_account'].id
|
||||
elif self.cleaned_data['target_type'] == "CLUB":
|
||||
self.cleaned_data['target_id'] = self.cleaned_data['club'].id
|
||||
elif self.cleaned_data['target_type'] == "COMPANY":
|
||||
self.cleaned_data['target_id'] = self.cleaned_data['company'].id
|
||||
if 'target_type' in self.cleaned_data.keys():
|
||||
if self.cleaned_data['target_type'] == "USER":
|
||||
self.cleaned_data['target_id'] = self.cleaned_data['user'].id
|
||||
elif self.cleaned_data['target_type'] == "ACCOUNT":
|
||||
self.cleaned_data['target_id'] = self.cleaned_data['club_account'].id
|
||||
elif self.cleaned_data['target_type'] == "CLUB":
|
||||
self.cleaned_data['target_id'] = self.cleaned_data['club'].id
|
||||
elif self.cleaned_data['target_type'] == "COMPANY":
|
||||
self.cleaned_data['target_id'] = self.cleaned_data['company'].id
|
||||
return self.cleaned_data
|
||||
|
||||
def save(self):
|
||||
|
Loading…
Reference in New Issue
Block a user