Try them and see if it helps! https://betterprogramming.pub/django-select-related-and-prefetch-related-f23043fd635d
Regards, Chetan Ganji +91-900-483-4183 [email protected] http://ryucoder.in On Thu, Feb 2, 2023 at 8:53 PM Mark Jones <[email protected]> wrote: > I have an admin with 1 row in the tabular inline. I have a custom > queryset in > > class ExtensionTabularInlineFormSet(BaseInlineFormSet): > def get_queryset(self) -> QuerySet[Extension]: > qs = super().get_queryset() > > This gets called 20 times to display that one row. When you have more > rows, it gets called 20 times/row. > > The culprit is calls to this method: > def initial_form_count(self): > """Return the number of forms that are required in this FormSet.""" > if not self.is_bound: > return len(self.get_queryset()) > return super().initial_form_count() > > The solution would be to cache this value, but admin views seem like > singletons way too often for this to work. Anyone else seen this? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/f4bacbd9-b519-45af-8e5b-826c4b5d9c88n%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/f4bacbd9-b519-45af-8e5b-826c4b5d9c88n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMKMUjs%3D8jOG%2BziTj0a3UWpTyBss9vNqOUPLzLDG4Q876MUBVw%40mail.gmail.com.

