Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
AE UTBM
Sith
Commits
43b1d1f3
Commit
43b1d1f3
authored
Jun 12, 2017
by
Krophil
Browse files
Fix operation form
parent
ecf54657
Pipeline
#1061
passed with stage
in 5 minutes and 1 second
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
accounting/views.py
View file @
43b1d1f3
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment