A note on the for_concrete_model attribute on a GenericForeignKey.

Be aware this is a draft post — please adjust your expectations accordingly. Get in touch if this post could use an improvement.

I do not see a lot of a indie blog posts on this subject, so I’m trying to send out a short and sweet note out to the web I suppose. Something that wasn’t written five or eight or ten years ago…

Odds are you will not encounter a GenericForeignKey early in your Django career. There are reasons to try and avoid it too.

Ok, the note. Sorry!

Basically, no migrations are needed when using or changing the value of for_concrete_model on a GenericForeignKey in your models.py module.

I tested this with django-moderation and was a little surprised.


Comment via email.