2015-01-07 10:35:09 +00:00
|
|
|
import datetime
|
2014-12-22 09:18:51 +00:00
|
|
|
from django.db import models
|
2015-03-14 09:54:17 +00:00
|
|
|
from juser.models import UserGroup, DEPT
|
2014-12-22 09:18:51 +00:00
|
|
|
|
2014-12-22 15:14:29 +00:00
|
|
|
|
|
|
|
class IDC(models.Model):
|
2014-12-30 14:48:39 +00:00
|
|
|
name = models.CharField(max_length=40, unique=True)
|
|
|
|
comment = models.CharField(max_length=80, blank=True, null=True)
|
2014-12-22 15:14:29 +00:00
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
2015-01-10 05:30:01 +00:00
|
|
|
|
2015-01-10 05:35:56 +00:00
|
|
|
class BisGroup(models.Model):
|
2015-01-31 04:55:10 +00:00
|
|
|
GROUP_TYPE = (
|
|
|
|
('P', 'PRIVATE'),
|
|
|
|
('A', 'ASSET'),
|
|
|
|
)
|
2015-01-07 10:35:09 +00:00
|
|
|
name = models.CharField(max_length=80, unique=True)
|
2015-03-14 09:54:27 +00:00
|
|
|
dept = models.ForeignKey(DEPT)
|
2015-01-07 10:35:09 +00:00
|
|
|
comment = models.CharField(max_length=160, blank=True, null=True)
|
2015-01-31 04:55:10 +00:00
|
|
|
type = models.CharField(max_length=1, choices=GROUP_TYPE, default='P')
|
2015-01-07 10:35:09 +00:00
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
2014-12-22 15:14:29 +00:00
|
|
|
|
|
|
|
class Asset(models.Model):
|
2014-12-30 14:48:39 +00:00
|
|
|
LOGIN_TYPE_CHOICES = (
|
|
|
|
('L', 'LDAP'),
|
|
|
|
('M', 'MAP'),
|
|
|
|
)
|
2014-12-22 15:14:29 +00:00
|
|
|
ip = models.IPAddressField(unique=True)
|
2014-12-30 14:48:39 +00:00
|
|
|
port = models.SmallIntegerField(max_length=5)
|
2014-12-22 15:14:29 +00:00
|
|
|
idc = models.ForeignKey(IDC)
|
2015-01-10 05:35:56 +00:00
|
|
|
bis_group = models.ManyToManyField(BisGroup)
|
2015-03-14 09:54:17 +00:00
|
|
|
dept = models.ManyToManyField(DEPT)
|
2014-12-30 14:48:39 +00:00
|
|
|
login_type = models.CharField(max_length=1, choices=LOGIN_TYPE_CHOICES, default='L')
|
2015-01-25 15:38:58 +00:00
|
|
|
username = models.CharField(max_length=20, blank=True, null=True)
|
|
|
|
password = models.CharField(max_length=80, blank=True, null=True)
|
2015-01-10 05:30:01 +00:00
|
|
|
date_added = models.DateTimeField(auto_now=True, default=datetime.datetime.now(), null=True)
|
2014-12-30 14:48:39 +00:00
|
|
|
is_active = models.BooleanField(default=True)
|
2014-12-22 15:14:29 +00:00
|
|
|
comment = models.CharField(max_length=100, blank=True, null=True)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.ip
|