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
Julien Jerphanion
Rex Dri
Commits
11d1d93f
Commit
11d1d93f
authored
Sep 13, 2018
by
Florent Chehab
Browse files
Bug corrected in how pending moderation were displayed
parent
ec10ad21
Changes
2
Hide whitespace changes
Inline
Side-by-side
backend/models/abstract/my_model/myModelSerializer.py
View file @
11d1d93f
...
...
@@ -41,12 +41,13 @@ class MyModelSerializer(MySerializerWithJSON):
return
self
.
Meta
.
model
.
model_config
def
get_pending_moderation
(
self
,
obj
):
pm
=
PendingModerationSerializer
(
obj
.
pending_moderation
,
many
=
True
,
read_only
=
True
,
context
=
self
.
context
).
data
if
self
.
context
[
'view'
].
action
==
'list'
:
return
len
(
pm
)
return
None
else
:
return
pm
ct
=
ContentType
.
objects
.
get_for_model
(
self
.
Meta
.
model
)
pending
=
PendingModeration
.
objects
.
filter
(
content_type
=
ct
,
object_id
=
obj
.
pk
)
return
PendingModerationSerializer
(
pending
,
many
=
True
,
read_only
=
True
,
context
=
self
.
context
).
data
def
get_id
(
self
,
obj
):
return
obj
.
pk
...
...
backend/models/abstract/my_model/myModelVersionned.py
View file @
11d1d93f
...
...
@@ -64,7 +64,6 @@ class VersionSerializer(MySerializerWithJSON):
try
:
tmp
=
list
(
djangoSerializers
.
deserialize
(
obj
.
format
,
data
,
ignorenonexistent
=
True
))[
0
]
print
(
tmp
.
object
)
# Version is valid,
obj_serializer
=
tmp
.
object
.
get_serializer
()
new_context
=
dict
(
self
.
context
)
...
...
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