def hostedit(request): template = get_template('edithost.html') if request.method == 'POST': form = forms.hostForms(request.POST) if form.is_valid(): host_ip = request.POST.get('host_ip', '') oHost = vo_Host.objects.get(uid=host_ip) oHost.ip = form.cleaned_data['ip'] oHost.description = form.cleaned_data['description'] oHost.save() return redirect('/host') host_ip = request.GET.get('id', '') oHost = vo_Host.objects.get(uid=host_ip) form = forms.hostForms({ 'ip' : oHost.ip, 'description' : oHost.description }) variables = Context({ 'form' : form, 'host_ip' : host_ip }) return HttpResponse(template.render(variables))
def hostedit(request): template = get_template('edithost.html') if request.method == 'POST': form = forms.hostForms(request.POST) if form.is_valid(): host_ip = request.POST.get('host_ip', '') oHost = vo_Host.objects.get(uid=host_ip) oHost.ip = form.cleaned_data['ip'] oHost.description = form.cleaned_data['description'] oHost.save() return redirect('/host') host_ip = request.GET.get('id', '') oHost = vo_Host.objects.get(uid=host_ip) form = forms.hostForms({'ip': oHost.ip, 'description': oHost.description}) variables = Context({'form': form, 'host_ip': host_ip}) return HttpResponse(template.render(variables))
def hostadd(request): template = get_template('addhost.html') if request.method == 'POST': form = forms.hostForms(request.POST) if form.is_valid(): oHost = vo_Host( uid=get_universally_unique_identifiers(), user=request.user, ip=form.cleaned_data['ip'], description=form.cleaned_data['description'], ) oHost.save() return redirect('/host') else: form = forms.hostForms() variables = Context({'form': form}) return HttpResponse(template.render(variables))
def hostadd(request): template = get_template('addhost.html') if request.method == 'POST': form = forms.hostForms(request.POST) if form.is_valid(): oHost = vo_Host( uid = get_universally_unique_identifiers(), user = request.user, ip = form.cleaned_data['ip'], description = form.cleaned_data['description'], ) oHost.save() return redirect('/host') else: form = forms.hostForms() variables = Context({ 'form' : form }) return HttpResponse(template.render(variables))