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.