usermodle

This commit is contained in:
liuzheng712
2015-09-15 23:38:06 +08:00
parent d32ea9f9a1
commit 79c79432f5
5 changed files with 129 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
#coding: utf-8
# coding: utf-8
from django.db import models
@@ -19,6 +19,21 @@ class UserGroup(models.Model):
self.save()
from django.contrib.auth.models import AbstractUser
class CustomUser(AbstractUser):
USER_ROLE_CHOICES = (
('SU', 'SuperUser'),
('GA', 'GroupAdmin'),
('CU', 'CommonUser'),
)
name = models.CharField(max_length=80)
uuid = models.CharField(max_length=100)
role = models.CharField(max_length=2, choices=USER_ROLE_CHOICES, default='CU')
group = models.ManyToManyField(UserGroup)
ssh_key_pwd = models.CharField(max_length=200)
class User(models.Model):
USER_ROLE_CHOICES = (
('SU', 'SuperUser'),
@@ -137,5 +152,3 @@ class AdminGroup(models.Model):
def __unicode__(self):
return '%s: %s' % (self.user.username, self.group.name)