1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-08 11:16:47 +00:00
webvirtcloud/webvirtcloud/serializers.py
catborise 3fed1d04b4 fix(api): a VM action answers with what the page would have shown after it
The API's VM actions call the web views and only looked at the status
code; the views report a partial result (a disk that was not deleted or
was kept, a template that was not started) as a message for the page
they redirect to. The API reported plain success and left the messages in
the session. Its answer now carries them in "messages".
2026-11-05 16:28:29 +03:00

14 lines
469 B
Python

from rest_framework import serializers
class StatusSerializer(serializers.Serializer):
"""Response body of API actions that only report a status message."""
status = serializers.CharField()
class ActionStatusSerializer(StatusSerializer):
"""A VM action's status and what the web page would have shown after it,
such as a disk that was kept or a template that was not started."""
messages = serializers.ListField(child=serializers.CharField())