Commit 11d1d93f authored by Florent Chehab's avatar Florent Chehab

Bug corrected in how pending moderation were displayed

parent ec10ad21
Pipeline #27299 passed with stages
in 2 minutes and 45 seconds
......@@ -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
......
......@@ -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)
......
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