git-svn-id: http://code.djangoproject.com/svn/django/trunk@6900 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
25f548a852
commit
5ed205bc8a
|
@ -118,7 +118,7 @@ class GenericRelation(RelatedField, Field):
|
|||
return self.object_id_field_name
|
||||
|
||||
def m2m_reverse_name(self):
|
||||
return self.object_id_field_name
|
||||
return self.model._meta.pk.column
|
||||
|
||||
def contribute_to_class(self, cls, name):
|
||||
super(GenericRelation, self).contribute_to_class(cls, name)
|
||||
|
|
|
@ -132,4 +132,8 @@ __test__ = {'API_TESTS':"""
|
|||
>>> [(t.tag, t.content_type, t.object_id) for t in TaggedItem.objects.all()]
|
||||
[(u'clearish', <ContentType: mineral>, 1), (u'salty', <ContentType: vegetable>, 2), (u'shiny', <ContentType: animal>, 2)]
|
||||
|
||||
>>> ctype = ContentType.objects.get_for_model(lion)
|
||||
>>> Animal.objects.filter(tags__content_type=ctype)
|
||||
[<Animal: Platypus>]
|
||||
|
||||
"""}
|
||||
|
|
Loading…
Reference in New Issue