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)
本文来自博客园,作者:super_ip,转载请注明原文链接:https://www.cnblogs.com/superip/p/17305219.html