def person_view(request, person_id=None): if person_id == None: person = Person() else: person = Person.objects.get(id = person_id) PhoneFormSet = inlineformset_factory(Person, Phone, can_delete=True) if request.method == "POST": personform = PersonForm(request.POST, instance=person) phoneformset = PhoneFormSet(request.POST, request.FILES, instance=person) if personform.is_valid() and phoneformset.is_valid(): personform.save() phoneformset.save() # Redirect to somewhere if '_save' in request.POST: return HttpResponseRedirect('/admin/person/person/') if '_addanother' in request.POST: return HttpResponseRedirect('/admin/person/person/add/') else: personform = PersonForm(instance=person) phoneformset = PhoneFormSet(instance=person) return render_to_response('person.html', { 'personform' : personform, 'phoneformset' : phoneformset, }) ### Template that renders all this goodness ###