mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	git-svn-id: http://code.djangoproject.com/svn/django/trunk@6900 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
		| @@ -118,7 +118,7 @@ class GenericRelation(RelatedField, Field): | |||||||
|         return self.object_id_field_name |         return self.object_id_field_name | ||||||
|  |  | ||||||
|     def m2m_reverse_name(self): |     def m2m_reverse_name(self): | ||||||
|         return self.object_id_field_name |         return self.model._meta.pk.column | ||||||
|  |  | ||||||
|     def contribute_to_class(self, cls, name): |     def contribute_to_class(self, cls, name): | ||||||
|         super(GenericRelation, self).contribute_to_class(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()] | >>> [(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)] | [(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>] | ||||||
|  |  | ||||||
| """} | """} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user