Commit 8ef99797 by Florian Apolloner

Merge pull request #159 from adamgreig/fix-serializing

Set serialize=False on TaggableManager to fix tagged object serializing
parents d29a2dfb 24b8b7ba
......@@ -73,7 +73,7 @@ class ExtraJoinRestriction(object):
class TaggableManager(RelatedField, Field):
def __init__(self, verbose_name=_("Tags"),
help_text=_("A comma-separated list of tags."), through=None, blank=False):
Field.__init__(self, verbose_name=verbose_name, help_text=help_text, blank=blank)
Field.__init__(self, verbose_name=verbose_name, help_text=help_text, blank=blank, null=True, serialize=False)
self.through = through or TaggedItem
self.rel = TaggableRel(self)
......
......@@ -5,6 +5,7 @@ from unittest import TestCase as UnitTestCase
import django
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core import serializers
from django.db import connection
from django.test import TestCase, TransactionTestCase
from django.utils import six
......@@ -336,6 +337,10 @@ class TaggableManagerTestCase(BaseTaggingTestCase):
apple.tags.add('red')
self.assertEqual(list(apple.tags.slugs()), ['green-and-juicy', 'red'])
def test_serializes(self):
apple = self.food_model.objects.create(name="apple")
serializers.serialize("json", (apple,))
class TaggableManagerDirectTestCase(TaggableManagerTestCase):
food_model = DirectFood
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment