标签:opened mamicode 对象 col b16 项目 src class enable
from kingadmin.admin_base import BaseKingAdmin class AdminSite(object): def __init__(self): self.enabled_admins = {} def register(self,model_class,admin_class=None): """注册admin表""" #print("register",model_class,admin_class) app_name = model_class._meta.app_label model_name = model_class._meta.model_name if not admin_class: #为了避免多个model共享同一个BaseKingAdmin内存对象 admin_class = BaseKingAdmin() else: admin_class = admin_class() admin_class.model = model_class #把model_class赋值给了admin_class if app_name not in self.enabled_admins: self.enabled_admins[app_name] = {} self.enabled_admins[app_name][model_name] = admin_class site = AdminSite()
CRM项目实战-kingadmin model obj list 页面开发
标签:opened mamicode 对象 col b16 项目 src class enable
原文地址:https://www.cnblogs.com/jintian/p/11306479.html