Django SVN Update Goes Splat

Published on Wednesday, May 9, 2007

I'm writing this just in case somebody runs into this same issue. I'm about to go live with a website and figured it would be best to have the latest SVN snapshot checked out from Django. I updated, and noticed that my voting module didn't quite work as expected. I was getting the following error:
'module' object has no attribute 'GenericForeignKey'

I jumped into Trac and noticed that just yesterday some things were rearranged. In short, if you are using generic relations, you'll need to change two parts of your code. First, the generic relations field must be imported out of conttenttype.
from django.contrib.contenttypes import generic

And second, you'll need to change the 'location prefix' (for lack of a better description:
generic_field = models.GenericRelation(SomeOtherModel)

generic_field = generic.GenericRelation(SomeOtherModel)

All should be find from there on out. For more information, take a look at the reference wiki article.