19 lines
431 B
Python

# -*- coding: utf-8 -*-
from django import forms
from django.contrib.auth.models import User
from main.models import *
class HostForm(forms.ModelForm):
class Meta:
model = Host
fields = ['fqdn', 'comment', ]
def create_host(self):
self.clean()
host = Host(fqdn=self.cleaned_data['fqdn'],
comment=self.cleaned_data['comment'])
host.save()
return host