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.

Reply via email to