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

[common][serializers] Move from JSONSerializerField to standard JSONField

And normalize custom fields imports/use.
parent 84c28ccb
No related branches found
No related tags found
1 merge request!327Refactor update creation api
This commit is part of merge request !327. Comments created here will be created in the context of that merge request.
...@@ -44,7 +44,8 @@ from ..common.utils import validate_restructuredtext ...@@ -44,7 +44,8 @@ from ..common.utils import validate_restructuredtext
from .models import Shareable, Versionable, Contribution from .models import Shareable, Versionable, Contribution
from .exceptions import ContributionCreationError from .exceptions import ContributionCreationError
from .fields import JSONSerializerField, StringListField
from . import fields as serializer_fields
# ---------------------------------------------------------- # ----------------------------------------------------------
...@@ -85,8 +86,8 @@ class CheckNameSerializer(serializers.Serializer): ...@@ -85,8 +86,8 @@ class CheckNameSerializer(serializers.Serializer):
class SharingSerializer(serializers.Serializer): class SharingSerializer(serializers.Serializer):
users = StringListField(required=False) users = serializer_fields.StringListField(required=False)
teams = StringListField(required=False) teams = serializer_fields.StringListField(required=False)
def validate_users(self, users): def validate_users(self, users):
user_accounts = User.objects.filter(username__in=users).values_list( user_accounts = User.objects.filter(username__in=users).values_list(
...@@ -300,7 +301,7 @@ class ContributionSerializer(VersionableSerializer): ...@@ -300,7 +301,7 @@ class ContributionSerializer(VersionableSerializer):
class ContributionModSerializer(serializers.ModelSerializer): class ContributionModSerializer(serializers.ModelSerializer):
declaration = JSONSerializerField(required=False) declaration = serializers.JSONField(required=False)
description = serializers.CharField(required=False, allow_blank=True) description = serializers.CharField(required=False, allow_blank=True)
class Meta: class Meta:
......
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