@handle_response_format
@treeio_login_required
def settings_view(request, response_format='html'):
    "Settings"

    if not request.user.profile.is_admin('treeio.identities'):
        return user_denied(request, message="You are not an Administrator of the Identities module",
                           response_format=response_format)

    contact_types = ContactType.objects.all().filter(trash=False)
    contact_fields = ContactField.objects.all().filter(trash=False)
    contacts = Object.filter_by_request(
        request, Contact.objects.order_by('name'))

    context = _get_default_context(request)
    context.update({'contact_types': contact_types,
                    'contact_fields': contact_fields,
                    'contacts': contacts})

    if request.POST:
        if 'file' in request.FILES:
            csv_file = request.FILES['file']

            # TODO: check file extension
            content = csv_file.read()
            import_c = ProcessContacts()
            import_c.import_contacts(content)

            return HttpResponseRedirect(reverse('identities_index'))

    return render_to_response('identities/settings_view', context,
                              context_instance=RequestContext(request), response_format=response_format)


#
# AJAX autocomplete handlers
#
dataset/ETHPy150Open treeio/treeio/treeio/identities/views.py/settings_view/original