Your approach seems a little more complicated than necessary. I would recommend using Django's related objects system: form.instance.item.subItem_set.all in your template should fetch all the subItems related to a specific Item. You could then remove those loops in your view where you fetch the related subItems yourself.