Add formset.management_form to make formset working again
Small fixes in the if statements, the end result is the same with less
code