Just interesting, how does it look in UI?
as usual, but only N kids shown instead of thousands
I'm still looking for the proper way. I think the get_formset method is more appropriate to apply the limits
there's a package for pagination of inlined objects (https://github.com/shinneider/django-admin-inline-paginator/blob/master/django_admin_inline_paginator/admin.py). I don't want to bring it in, as I don't really need pagination. But that code led me to this solution
class ParentKidsInline(admin.TabularInline):
...
def get_formset(self, request, obj=None, **kwargs):
class LimitedFormSet(super().get_formset(request, obj, **kwargs)):
def get_queryset(self):
return self.queryset[:10]
return LimitedFormSet
Not as clean as I'd like, but I think it's the right direction. I have to rtfm :)
BTW, the creator of https://github.com/shinneider/django-admin-inline-paginator has been looking for a new maintainer (see the footer)