Answers for "drf model serializers"

2

drf serializer

serializer = CommentSerializer(data={'email': 'foobar', 'content': 'baz'})
serializer.is_valid()
# False
serializer.errors
# {'email': ['Enter a valid e-mail address.'], 'created': ['This field is required.']}
Posted by: Guest on June-04-2020
0

drf model serializers

class AccountSerializer(serializers.ModelSerializer):
    class Meta:
        model = Account
        fields = ['id', 'account_name', 'users', 'created']
Posted by: Guest on August-06-2021

Browse Popular Code Answers by Language