Skip to content
Snippets Groups Projects
Commit 88b7b05d authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[plotters][serializers] Add explicit data json field

This allows the PlotterParameterCreationSerializer to properly
handle the json given as data parameter.
parent b31416e7
No related branches found
No related tags found
2 merge requests!2551.4.x,!249Web fixes
...@@ -112,6 +112,7 @@ class PlotterParameterCreationFailedException(Exception): ...@@ -112,6 +112,7 @@ class PlotterParameterCreationFailedException(Exception):
pass pass
class PlotterParameterCreationSerializer(ContributionCreationSerializer): class PlotterParameterCreationSerializer(ContributionCreationSerializer):
data = serializers.JSONField(required=False)
class Meta(ContributionCreationSerializer.Meta): class Meta(ContributionCreationSerializer.Meta):
model = PlotterParameter model = PlotterParameter
...@@ -223,7 +224,6 @@ class FullPlotterParameterSerializer(PlotterParameterAllSerializer): ...@@ -223,7 +224,6 @@ class FullPlotterParameterSerializer(PlotterParameterAllSerializer):
def get_plotters(self, obj): def get_plotters(self, obj):
all_plotters = Plotter.objects.all() all_plotters = Plotter.objects.all()
serializer = FullPlotterSerializer
results = {} results = {}
for plotter in all_plotters.iterator(): for plotter in all_plotters.iterator():
serializer = FullPlotterSerializer(plotter, context=self.context, fields=['id', 'accessibility', 'modifiable', 'deletable', 'is_owner', 'name', 'fork_of', 'last_version', 'previous_version', 'short_description', 'description', 'version', 'creation_date', 'data', 'sample_data', 'declaration']) serializer = FullPlotterSerializer(plotter, context=self.context, fields=['id', 'accessibility', 'modifiable', 'deletable', 'is_owner', 'name', 'fork_of', 'last_version', 'previous_version', 'short_description', 'description', 'version', 'creation_date', 'data', 'sample_data', 'declaration'])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment