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)