From b7a8f9e53d3190cf50719c2b79c80985aa98564a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sascha=20I=C3=9Fbr=C3=BCcker?= Date: Thu, 18 Feb 2021 22:02:45 +0100 Subject: [PATCH] Mark optional fields in bookmark serializer (#78) --- bookmarks/api/serializers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bookmarks/api/serializers.py b/bookmarks/api/serializers.py index 6492b9e..7f8f65d 100644 --- a/bookmarks/api/serializers.py +++ b/bookmarks/api/serializers.py @@ -30,8 +30,11 @@ class BookmarkSerializer(serializers.ModelSerializer): '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 - tag_names = TagListField() + tag_names = TagListField(required=False, default=[]) def create(self, validated_data): bookmark = Bookmark()