﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
8309	GenericForeignKey fails when used in abstract base models	Wonlay	Jacob	"The following code will reproduce this bug:

{{{
# aaa/models.py
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic

class MyModel(models.Model):
	field = models.IntegerField()

class TaggedItemBase(models.Model):
	class Meta:
		abstract = True

	content_type = models.ForeignKey(ContentType)
	object_id = models.PositiveIntegerField()

	content_object = generic.GenericForeignKey()

class TaggedItem(TaggedItemBase):
	""""""A tag on an item.""""""
	tag = models.SlugField()

	class Meta:
		ordering = [""tag""]

	def __unicode__(self):
		return self.tag


# From command shell
>>> from aaa.models import MyModel, TaggedItem
>>> m = MyModel(field=1)
>>> m.save()
>>> t = TaggedItem(content_object=m, tag=""my"")
Traceback (most recent call last):
  File ""<console>"", line 1, in ?
  File ""/usr/lib/python2.4/site-packages/django/db/models/base.py"", line 240, in __init__
    raise TypeError, ""'%s' is an invalid keyword argument for this function"" % kwargs.keys()[0]
TypeError: 'content_object' is an invalid keyword argument for this function
}}}


If we do not use model inheritance, the script works fine.
"		closed	Contrib apps	dev		fixed	GenericForeignKey , model inheritance	carl@… wonlay@… albrecht.andi@… gonz@…	Accepted	1	0	0	0	0	0
