# What are the drawbacks/risks with using Generic Relations?

**URL:** <https://forum.djangoproject.com/t/what-are-the-drawbacks-risks-with-using-generic-relations/30305>\
**Category:** Using the ORM\
**Created:** [April 18, 2024, 1:46pm UTC](https://forum.djangoproject.com/t/what-are-the-drawbacks-risks-with-using-generic-relations/30305 "2024-04-18T13:46:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnthagen](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/johnthagen/32/2774_2.png) [@johnthagen](https://forum.djangoproject.com/u/johnthagen)\
**Post date:** [April 18, 2024, 1:46pm UTC](https://forum.djangoproject.com/t/what-are-the-drawbacks-risks-with-using-generic-relations/30305/1 "2024-04-18T13:46:53Z")

</div>

From the Generic Relations docs

- [The contenttypes framework | Django documentation | Django](https://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#generic-relations)

I stumbled across this ticket

- [#23435 (GenericForeignKey should be indexed) – Django](https://code.djangoproject.com/ticket/23435)

Who’s first line is

> (Yes, I know GFKs are evil and should be avoided at all costs. Nonetheless, as long as Django supports them, people will use them.)

So as someone new to Generic Relations, should they be considered an anti-pattern? Are there tradeoffs or risks to maintainability? If I have data that does model most directly to having a foreign key that points to multiple distinct `Model`s, are there other options I should be considering instead?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [April 19, 2024, 12:46am UTC](https://forum.djangoproject.com/t/what-are-the-drawbacks-risks-with-using-generic-relations/30305/2 "2024-04-19T00:46:54Z")

</div>

> [@johnthagen](#):
>
> So as someone new to Generic Relations, should they be considered an anti-pattern?

`<opinion>`  
Superficially, Yes.

More accurately, I’d put them in the category of “Limited and specific use”.

Yes, they’re useful. But, they shouldn’t be used as a general solution to a wide variety of situations. There are some very specific and targeted cases where they are the right answer. However, they’re frequently considered for use in situations where other solutions would be more appropriate.  
`</opinion>`

For more details on this perspective, see the blog post at [Avoid Django's GenericForeignKey - lukeplant.me.uk](https://lukeplant.me.uk/blog/posts/avoid-django-genericforeignkey/)

I didn’t write it, but it says everything I would about the subject, plus some.

Regarding the alternives, there’s no “pat answer” for that. Deciding what solution should be used can only be made with a full understading of the complete system being modeled. It may even turn out that in your particular case, generic relations _are_ the right answer.
