From ec7999775cc74f3eee97b84eb4e4ef9341da594b Mon Sep 17 00:00:00 2001 From: Ken Raffenetti Date: Thu, 21 Sep 2006 21:57:44 +0000 Subject: tweaks to dhcp generation git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2297 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Server/Hostbase/hostbase/views.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/lib/Server/Hostbase/hostbase/views.py') diff --git a/src/lib/Server/Hostbase/hostbase/views.py b/src/lib/Server/Hostbase/hostbase/views.py index c45f187d8..8d7fd3d3a 100644 --- a/src/lib/Server/Hostbase/hostbase/views.py +++ b/src/lib/Server/Hostbase/hostbase/views.py @@ -450,6 +450,12 @@ def new(request): """Function for creating a new host in hostbase Data is validated before committed to the database""" if request.GET.has_key('sub'): + try: + Host.objects.get(hostname=request.POST['hostname']) + return render_to_response('errors.html', + {'failures': ['%s already exists in hostbase' % request.POST['hostname']]}) + except: + pass if not validate(request, True): host = Host() # this is the stuff that validate() should take care of @@ -459,6 +465,8 @@ def new(request): for attrib in attribs: if request.POST.has_key(attrib): host.__dict__[attrib] = request.POST[attrib] + if request.POST.has_key('expiration_date'): + host.__dict__['expiration_date'] = date(2000, 1, 1) host.status = 'active' host.save() else: -- cgit v1.2.3-1-g7c22