Django 同一Model注册多个modelAdmin

需求: 同一个django model模型,根据不同需求展示注册到admin.py中

class UserMsg(models.Model):
    username = models.CharField(max_length=20, null=False, verbose_name='发送方')
    hername = models.CharField(max_length=20, null=True, verbose_name='对方姓名')
    title = models.CharField(max_length=50, verbose_name='标题')
    img_base64 = models.TextField(max_length=1500, null=True, verbose_name='图片')
class SW_Article(UserMsg):
    class Meta:
        verbose_name = "单独定义-测试"
        verbose_name_plural = verbose_name
        proxy = True     

在admin.py中注册

admin.site.register(SW_Article)

 

posted @ 2023-04-11 09:50  super_ip  阅读(67)  评论(0编辑  收藏  举报