Commit ae115b53 by Carl Meyer

fix custom PKs

parent 6781567d
......@@ -102,7 +102,7 @@ class TaggableManager(object):
def m2m_reverse_name(self):
if self.use_gfk:
return "id"
return self.through._meta.get_field('content_object').rel.to._meta.pk.column
return self.through._meta.pk.column
def m2m_column_name(self):
if self.use_gfk:
......
......@@ -70,7 +70,8 @@ class TaggableManagerTestCase(BaseTaggingTest):
apple.delete()
self.assert_tags_equal(self.food_model.tags.all(), ["green"])
def test_require_pk(self):
f = self.food_model()
with self.assert_raises(ValueError):
f.tags.all()
......@@ -178,6 +179,10 @@ class TaggableManagerCustomPKTestCase(TaggableManagerTestCase):
housepet_model = CustomPKHousePet
taggeditem_model = TaggedCustomPKPet
def test_require_pk(self):
# XXX with a charfield pk, pk is never None, so taggit has no
# way to tell if the instance is saved or not
pass
class TaggableFormTestCase(BaseTaggingTest):
form_class = FoodForm
......
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