Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
l y
Jumpserver
Commits
09d42281
Unverified
Commit
09d42281
authored
3 years ago
by
feng626
Committed by
GitHub
3 years ago
Browse files
Options
Download
Plain Diff
Merge pull request #7102 from jumpserver/pr@dev@ticket_tips
perf: 工单错误提示优化
parents
2e4b6d15
3ae8da23
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/tickets/serializers/ticket/meta/ticket_type/apply_application.py
+7
-8
.../serializers/ticket/meta/ticket_type/apply_application.py
apps/tickets/serializers/ticket/ticket.py
+1
-1
apps/tickets/serializers/ticket/ticket.py
with
8 additions
and
9 deletions
+8
-9
apps/tickets/serializers/ticket/meta/ticket_type/apply_application.py
+
7
-
8
View file @
09d42281
...
...
@@ -80,12 +80,11 @@ class ApplySerializer(serializers.Serializer):
applications
=
Application
.
objects
.
filter
(
id__in
=
apply_applications
,
type
=
type
).
values_list
(
'id'
,
flat
=
True
)
return
list
(
applications
)
def
validate_apply_date_expired
(
self
,
value
):
date_start
=
self
.
root
.
initial_data
[
'meta'
].
get
(
'apply_date_start'
)
date_start
=
datetime
.
strptime
(
date_start
,
'%Y-%m-%dT%H:%M:%S.%fZ'
)
date_expired
=
self
.
root
.
initial_data
[
'meta'
].
get
(
'apply_date_expired'
)
date_expired
=
datetime
.
strptime
(
date_expired
,
'%Y-%m-%dT%H:%M:%S.%fZ'
)
if
date_expired
<=
date_start
:
def
validate
(
self
,
attrs
):
apply_date_start
=
attrs
[
'apply_date_start'
]
apply_date_expired
=
attrs
[
'apply_date_expired'
]
if
apply_date_expired
<=
apply_date_start
:
error
=
_
(
'The expiration date should be greater than the start date'
)
raise
serializers
.
ValidationError
(
error
)
return
value
raise
serializers
.
ValidationError
(
{
'apply_date_expired'
:
error
}
)
return
attrs
This diff is collapsed.
Click to expand it.
apps/tickets/serializers/ticket/ticket.py
+
1
-
1
View file @
09d42281
...
...
@@ -160,7 +160,7 @@ class TicketFlowApproveSerializer(serializers.ModelSerializer):
def
validate
(
self
,
attrs
):
if
attrs
[
'strategy'
]
==
TicketApprovalStrategy
.
custom_user
and
not
attrs
.
get
(
'assignees'
):
error
=
_
(
'Please select the Assignees'
)
raise
serializers
.
ValidationError
(
error
)
raise
serializers
.
ValidationError
(
{
'assignees'
:
error
}
)
return
super
().
validate
(
attrs
)
...
...
This diff is collapsed.
Click to expand it.
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