diff --git a/api/serializers.py b/api/serializers.py index 433ae564..73da3e1a 100644 --- a/api/serializers.py +++ b/api/serializers.py @@ -132,7 +132,7 @@ class NoteSerializer(TaggitSerializer, CoreModelSerializer): model = models.Note fields = ("id", "child", "note", "time", "tags") - tags = TagListSerializerField() + tags = TagListSerializerField(required=False) class SleepSerializer(CoreModelWithDurationSerializer): diff --git a/api/tests.py b/api/tests.py index f7f299c7..0a028be6 100644 --- a/api/tests.py +++ b/api/tests.py @@ -251,13 +251,14 @@ class NoteAPITestCase(TestBase.BabyBuddyAPITestCaseBase): def test_get(self): response = self.client.get(self.endpoint) self.assertEqual(response.status_code, status.HTTP_200_OK) - self.assertEqual( + self.assertDictEqual( response.data["results"][0], { "id": 1, "child": 1, "note": "Fake note.", "time": "2017-11-17T22:45:00-05:00", + "tags": [], }, ) diff --git a/core/models.py b/core/models.py index 41d99ad3..abfde876 100644 --- a/core/models.py +++ b/core/models.py @@ -14,8 +14,8 @@ from django.core.validators import RegexValidator import random -from taggit.managers import TaggableManager -from taggit.models import TagBase, GenericTaggedItemBase, TaggedItemBase +from taggit.managers import TaggableManager as TaggitTaggableManager +from taggit.models import TagBase, GenericTaggedItemBase random.seed() @@ -135,7 +135,7 @@ class Tagged(GenericTaggedItemBase): return super().save_base(*args, **kwargs) -class TaggableManager(TaggableManager): +class TaggableManager(TaggitTaggableManager): """ Remove default help_text - only reason for this to exist. """