From bc5422821d759b7f99faedce7b1baebe94fdb531 Mon Sep 17 00:00:00 2001 From: ibuler Date: Mon, 22 Dec 2014 23:36:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0jpermssion=20models?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jpermission/models.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/jpermission/models.py b/jpermission/models.py index 71a836239..26c1fa3de 100644 --- a/jpermission/models.py +++ b/jpermission/models.py @@ -1,3 +1,19 @@ from django.db import models +from juser.models import User +from jasset.models import Asset -# Create your models here. + +class Permission(models.Model): + PERM_USER_TYPE_CHOICE = ( + ('S', 'Super'), + ('C', 'Common'), + ) + user = models.ForeignKey(User) + asset = models.ForeignKey(Asset) + is_ldap = models.BooleanField(default=True) + perm_user_type = models.CharField(choices=PERM_USER_TYPE_CHOICE, + blank=True, + null=True) + + def __unicode__(self): + return '%s_%s' % (self.user.username, self.asset.ip) \ No newline at end of file