models.py 737 B

123456789101112131415161718192021
  1. from django.db import models
  2. from utils.models import BaseModel
  3. # Create your models here.
  4. class Bar(BaseModel):
  5. authName = models.CharField(max_length=200, default='', verbose_name="菜单名称")
  6. path = models.CharField(max_length=200, default='', verbose_name="跳转路径")
  7. partment = models.ForeignKey(to='self',null=True,on_delete=models.CASCADE,verbose_name="所属父类", related_name="children")
  8. icon = models.CharField(max_length=200, default='', verbose_name="图标")
  9. class Meta:
  10. db_table = 'django_bar'
  11. verbose_name = '菜单表'
  12. verbose_name_plural = verbose_name
  13. def __str__(self):
  14. return self.authName
  15. def __unicode__(self):
  16. return self.authName