def update(request, pk, slug=None, template='contacts/person/update.html'):


    user = request.user
    if not user.has_perm('change_person'):
        return HttpResponseForbidden()

    try:
        person = Person.objects.get(pk__iexact=pk)
    except person.DoesNotExist:
        raise Http404

    if request.method == 'POST':
        form = PersonUpdateForm(request.POST, instance=person)
        phone_formset = PhoneNumberFormSet(request.POST, instance=person)
        email_formset = EmailAddressFormSet(request.POST, instance=person)
        im_formset = InstantMessengerFormSet(request.POST, instance=person)
        website_formset = WebSiteFormSet(request.POST, instance=person)
        address_formset = StreetAddressFormSet(request.POST, instance=person)
        special_date_formset = SpecialDateFormSet(request.POST, instance=person)

        if form.is_valid() and phone_formset.is_valid() and \
            email_formset.is_valid() and im_formset.is_valid() and \
            website_formset.is_valid() and address_formset.is_valid():
            form.save()
            phone_formset.save()
            email_formset.save()
            im_formset.save()
            website_formset.save()
            address_formset.save()
            special_date_formset.save()
            return HttpResponseRedirect(person.get_absolute_url())
        else:
            return HttpResponseServerError

    form = PersonUpdateForm(instance=person)
    phone_formset = PhoneNumberFormSet(instance=person)
    email_formset = EmailAddressFormSet(instance=person)
    im_formset = InstantMessengerFormSet(instance=person)
    website_formset = WebSiteFormSet(instance=person)
    address_formset = StreetAddressFormSet(instance=person)
    special_date_formset = SpecialDateFormSet(instance=person)

    kwvars = {
        'form': form,
        'phone_formset': phone_formset,
        'email_formset': email_formset,
        'im_formset': im_formset,
        'website_formset': website_formset,
        'address_formset': address_formset,
        'special_date_formset': special_date_formset,
        'object': person,
    }

    return render_to_response(template, kwvars, RequestContext(request))
Update a person.
dataset/ETHPy150Open myles/django-contacts/src/contacts/views/person.py/update