Mark optional fields in bookmark serializer (#78)

This commit is contained in:
Sascha Ißbrücker 2021-02-18 22:02:45 +01:00 committed by GitHub
parent afe081d3b5
commit b7a8f9e53d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,8 +30,11 @@ class BookmarkSerializer(serializers.ModelSerializer):
'date_modified' 'date_modified'
] ]
# Override optional char fields to provide default value
title = serializers.CharField(required=False, allow_blank=True, default='')
description = serializers.CharField(required=False, allow_blank=True, default='')
# Override readonly tag_names property to allow passing a list of tag names to create/update # Override readonly tag_names property to allow passing a list of tag names to create/update
tag_names = TagListField() tag_names = TagListField(required=False, default=[])
def create(self, validated_data): def create(self, validated_data):
bookmark = Bookmark() bookmark = Bookmark()