From f906ac1ac2e2fe9eeba2676881e5f3e16c60a89b Mon Sep 17 00:00:00 2001 From: Samuel Gaist <samuel.gaist@idiap.ch> Date: Thu, 23 Apr 2020 09:39:48 +0200 Subject: [PATCH] [common][serializers] Move from JSONSerializerField to standard JSONField And normalize custom fields imports/use. --- beat/web/common/serializers.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/beat/web/common/serializers.py b/beat/web/common/serializers.py index 8ad155b06..c77cc6b68 100644 --- a/beat/web/common/serializers.py +++ b/beat/web/common/serializers.py @@ -44,7 +44,8 @@ from ..common.utils import validate_restructuredtext from .models import Shareable, Versionable, Contribution from .exceptions import ContributionCreationError -from .fields import JSONSerializerField, StringListField + +from . import fields as serializer_fields # ---------------------------------------------------------- @@ -85,8 +86,8 @@ class CheckNameSerializer(serializers.Serializer): class SharingSerializer(serializers.Serializer): - users = StringListField(required=False) - teams = StringListField(required=False) + users = serializer_fields.StringListField(required=False) + teams = serializer_fields.StringListField(required=False) def validate_users(self, users): user_accounts = User.objects.filter(username__in=users).values_list( @@ -300,7 +301,7 @@ class ContributionSerializer(VersionableSerializer): class ContributionModSerializer(serializers.ModelSerializer): - declaration = JSONSerializerField(required=False) + declaration = serializers.JSONField(required=False) description = serializers.CharField(required=False, allow_blank=True) class Meta: -- GitLab