def METHOD_NAME(self):
    num_categories = 0
    for i in range(0, self.total_form_count()):
        form = self.forms[i]
        if (
            hasattr(form, "cleaned_data")
            and form.cleaned_data.get("category", None)
            and not form.cleaned_data.get("DELETE", False)
        ):
            num_categories += 1
    return num_categories