Ejemplo n.º 1
0
def AddHost(request):
    form = HostListForm(request.POST)
    if form.is_valid():
        form.save()
        return HttpResponseRedirect(reverse('listhosturl'))
    else:
        form = HostListForm()

    kwvars = {
        'form': form,
        'request': request,
    }

    return render_to_response('HostManage/host.add.html', kwvars, RequestContext(request))
Ejemplo n.º 2
0
def AddHost(request):
    form = HostListForm(request.POST)
    if form.is_valid():
        form.save()
        return HttpResponseRedirect(reverse('listhosturl'))
    else:
        form = HostListForm()

    kwvars = {
        'form': form,
        'request': request,
    }

    return render_to_response('HostManage/host.add.html', kwvars,
                              RequestContext(request))
Ejemplo n.º 3
0
def EditHost(request, ID):
    host = HostList.objects.get(id=ID)

    if request.method == 'POST':
        form = HostListForm(request.POST, instance=host)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect(reverse('listhosturl'))
    else:
        form = HostListForm(instance=host)

    kwvars = {
        'ID': ID,
        'form': form,
        'request': request,
    }

    return render_to_response('HostManage/host.edit.html', kwvars, RequestContext(request))
Ejemplo n.º 4
0
def EditHost(request, ID):
    host = HostList.objects.get(id=ID)

    if request.method == 'POST':
        form = HostListForm(request.POST, instance=host)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect(reverse('listhosturl'))
    else:
        form = HostListForm(instance=host)

    kwvars = {
        'ID': ID,
        'form': form,
        'request': request,
    }

    return render_to_response('HostManage/host.edit.html', kwvars,
                              RequestContext(request))