---
title: "Comment by Ander on \"Reducing queries for ForeignKeys in Django admin inlines\" | Hashnode"
description: "I am having performance issues because of the inlines, I am really curious about your solution, but is it just for Django v4? that way of defining inlines = [&q"
url: "https://hashnode.com/posts/reducing-queries-for-foreignkeys-in-django-admin-inlines/63becbe911c7835807fb28cb/comment/64cc4f4a8c8620c6865545fc"
---

[Discussion](https://hashnode.com/posts/reducing-queries-for-foreignkeys-in-django-admin-inlines/63becbe911c7835807fb28cb)

Comment [Reducing queries for ForeignKeys in Django admin inlines](https://hashnode.com/posts/reducing-queries-for-foreignkeys-in-django-admin-inlines/63becbe911c7835807fb28cb)

[Ander](https://hashnode.com/@AnderUstarroz)

[Aug 4, 2023](https://hashnode.com/posts/reducing-queries-for-foreignkeys-in-django-admin-inlines/63becbe911c7835807fb28cb/comment/64cc4f4a8c8620c6865545fc)

I am having performance issues because of the inlines, I am really curious about your solution, but is it just for Django v4? that way of defining inlines = \["some-inline"\] as strings doesn't look familiar, shouldn't that be classes instead?

[Jurrian Tromp](https://hashnode.com/@jurrian)

[Aug 19, 2023](https://hashnode.com/posts/reducing-queries-for-foreignkeys-in-django-admin-inlines/63becbe911c7835807fb28cb/comment/64cc4f4a8c8620c6865545fc#reply-64e06a78fe582aa061c3f8bd)

AFAIK this is applies to all Django versions. You are right that they should be classes instead. It might be that as a string it still works as lazy loading, so probably both work. The key of the problem is how the Django internals work in such a way that it creates a lot of extra queries.
