Counting form fieldset and inlines in ModelAdmin Changeform

hi,

I’m customising my model change form in admin. I wish to disable my override on some pages based if the page has no inlines or fieldsets. Does anyone know how to count the number for fieldsets and inlines in a template ?

Here’s at i came up with

{% inline_admin_formsets.count|add:adminform.count < 1  %}