

@handle_response_format
def database_setup(request, response_format='html'):
    if (not User.objects.all().count()):
        if request.POST:
            sql_form = SqlSettingsForm(data=request.POST)
            if sql_form.is_valid():
                sql_form.create_database()
                if sql_form.is_valid():
                    return HttpResponseRedirect('/')
        else:
            sql_form = SqlSettingsForm()
        return render_to_response('core/database_setup', {
            'sql_form': sql_form,
        }, context_instance=RequestContext(request), response_format=response_format)
    return HttpResponseRedirect('/')

dataset/ETHPy150Open treeio/treeio/treeio/core/views.py database_setup/original