Project

Profile

Help

Issue #4394

closed

Content serializer validate should ensure a saveable object

Added by mdellweg about 5 years ago. Updated over 4 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

This may be up for discussion:
In the current state, the content serializer family can validate content objects containing artifacts, but when valid, the user is supposed to pop off the `_artifact{,s}` field and create the `ContentArtifact` entities on his own.
I think, if the serializer said, an object is valid, a subsequent `save` without further parameters should just work.

In my approach, i tried to follow the example in [0]. This has the nice side-effect, that the plugin writer is not anymore concerned with handling the `ContentArtifacts` at all.

[0] https://www.django-rest-framework.org/api-guide/serializers/#writing-create-methods-for-nested-representations


Related issues

Related to RPM Support - Issue #4472: Relative_path error when uploading a fileCLOSED - CURRENTRELEASEdaviddavisActions

Also available in: Atom PDF