Commit a96efafc authored by Skia's avatar Skia
Browse files

Merge branch 'counter' into 'master'

Fix operation form

See merge request !82
parents 8ca455a3 43b1d1f3
Pipeline #1063 passed with stage
in 4 minutes and 56 seconds
......@@ -305,8 +305,8 @@ class OperationForm(forms.ModelForm):
def clean(self):
self.cleaned_data = super(OperationForm, self).clean()
if 'target_type' in self.cleaned_data.keys():
if self.cleaned_data.get("user") is None or self.cleaned_data.get("club") or self.cleaned_data.get("club_account") is None or self.cleaned_data.get("company") is None or self.cleaned_data.get("other"):
self.add_error('target_id', ValidationError(_("The target must be set.")))
if self.cleaned_data.get("user") is None and self.cleaned_data.get("club") is None and self.cleaned_data.get("club_account") is None and self.cleaned_data.get("company") is None and self.cleaned_data.get("target_label") is None:
self.add_error('target_type', ValidationError(_("The target must be set.")))
else:
if self.cleaned_data['target_type'] == "USER":
self.cleaned_data['target_id'] = self.cleaned_data['user'].id
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment