from__future__ Import unicode_literals fromdjango.contrib.auth.models Import User fromdjango.db Import models# Create your models here.classHost (models. Model): Hostame= Models. Charfield (max_length= -) IP=models. Genericipaddressfield () port=models. Integerfield () system_type_choices=( ('Linux','LINUX'), ('Wind64','Windows64'),) System_type=models. Charfield (choices=system_type_choices,max_length= -) Enable= Models. Booleanfield (default=True) Online_date= Models. Datetimefield (auto_now_add=True) Groups= Models. Manytomanyfield ('HostGroup') IDC= Models. ForeignKey ('IDC') def __unicode__ (self):returnSelf.hostameclassHostGroup (models. Model): Name= Models. Charfield (max_length= -, unique=True) def __unicode__ (self):returnSelf.nameclassIDC (models. Model): Name= Models. Charfield (max_length= -, unique=True) def __unicode__ (self):returnSelf.nameclassUserProfile (models. Model): User=models. Onetoonefield (User) name= Models. Charfield (max_length= -, unique=True) host_groups= Models. Manytomanyfield ("HostGroup", Blank=true,NULL=True) hosts= Models. Manytomanyfield ('Host', Blank=true,NULL=true)
CMDB Models Database structure