I've defined a model using a generic foreign key which is basically exactly like the tagging example provided in the Django docs:
from django.db import models from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes import generic class WordedItem(models.Model): word = models.ForeignKey(FoodWord) content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() content_object = generic.GenericForeignKey('content_type', 'object_id') def __unicode__(self): return self.word However, when I try to create a WordedItem object using the syntax that I literally copied and pasted from the documentation it fails, telling me that 'content_object' is not a field. Initially I tried using get_or_create() which failed in the same way, but that appears to be a known bug (#6805). I've tried doing both this: obj, created = WordedItem.objects.get_or_create(content_object=match, word=word) and this: try: obj = WordedItem.objects.get(content_object=match, word=word) except WordedItem.DoesNotExist: obj = WordedItem(content_object=match, word=word) obj.save() num_created += 1 Regardless, I end up with this: TypeError: Cannot resolve keyword 'content_object' into field. Choices are: id, word, content_type, object_id --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---