@handle_response_format
@treeio_login_required
def field_edit(request, field_id, response_format='html'):
    "ContactField edit"

    field = get_object_or_404(ContactField, pk=field_id)
    if not request.user.profile.has_permission(field, mode='w'):
        return user_denied(request, message="You don't have access to this Field Type",
                           response_format=response_format)

    if request.POST:
        if 'cancel' not in request.POST:
            form = ContactFieldForm(request.POST, instance=field)
            if form.is_valid():
                field = form.save(request)
                return HttpResponseRedirect(reverse('identities_field_view', args=[field.id]))
        else:
            return HttpResponseRedirect(reverse('identities_field_view', args=[field.id]))
    else:
        form = ContactFieldForm(instance=field)

    context = _get_default_context(request)
    context.update({'form': form,
                    'field': field})

    return render_to_response('identities/field_edit', context,
                              context_instance=RequestContext(request), response_format=response_format)
dataset/ETHPy150Open treeio/treeio/treeio/identities/views.py/field_edit/original