码迷,mamicode.com
首页 > 数据库 > 详细

cmdb models数据库结构

时间:2016-04-15 13:51:47      阅读:389      评论:0      收藏:0      [点我收藏+]

标签:



from
__future__ import unicode_literals from django.contrib.auth.models import User from django.db import models # Create your models here. class Host(models.Model): hostame = models.CharField(max_length=64) ip = models.GenericIPAddressField() port = models.IntegerField() system_type_choices=( (linux,LINUX), (wind64,Windows64), ) system_type=models.CharField(choices=system_type_choices,max_length=64) enable = models.BooleanField(default=True) online_date = models.DateTimeField(auto_now_add=True) groups = models.ManyToManyField(HostGroup) idc = models.ForeignKey(IDC) def __unicode__(self): return self.hostame class HostGroup(models.Model): name = models.CharField(max_length=64,unique=True) def __unicode__(self): return self.name class IDC(models.Model): name = models.CharField(max_length=64,unique=True) def __unicode__(self): return self.name class UserProfile(models.Model): user = models.OneToOneField(User) name = models.CharField(max_length=64,unique=True) host_groups = models.ManyToManyField("HostGroup",blank=True,null=True) hosts = models.ManyToManyField(Host,blank=True,null=True)

 

cmdb models数据库结构

标签:

原文地址:http://www.cnblogs.com/fengjian2016/p/5394884.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!