标签:false HERE model mis __str__ menu 权限表 密码 def
1 from django.db import models 2 3 # Create your models here. 4 5 class Permission(models.Model): 6 ‘‘‘ 7 权限表 8 ‘‘‘ 9 title = models.CharField(verbose_name=‘标题‘, max_length=32) 10 url = models.CharField(verbose_name=‘含正则的URL‘, max_length=128) 11 is_menu = models.BooleanField(verbose_name=‘是否可做菜单‘, default=False) 12 icon = models.CharField(verbose_name=‘图标‘, max_length=32, null=True, blank=True) 13 14 def __str__(self): 15 return self.title 16 17 class Role(models.Model): 18 ‘‘‘ 19 角色表 20 ‘‘‘ 21 title = models.CharField(verbose_name=‘角色‘, max_length=32) 22 permission = models.ManyToManyField(verbose_name=‘拥有的所有权限‘, to=‘Permission‘, blank=True) 23 24 def __str__(self): 25 return self.title 26 27 class UserInfo(models.Model): 28 ‘‘‘ 29 用户表 30 ‘‘‘ 31 name = models.CharField(verbose_name=‘用户名‘, max_length=32) 32 password = models.CharField(verbose_name=‘密码‘, max_length=64) 33 email = models.CharField(verbose_name=‘邮箱‘, max_length=32) 34 role = models.ManyToManyField(verbose_name=‘担任的角色‘, to=‘Role‘, blank=True) 35 36 def __str__(self): 37 return self.name
标签:false HERE model mis __str__ menu 权限表 密码 def
原文地址:https://www.cnblogs.com/xiongfanyong/p/13003127.html