修改文件 common_apps\xadmin\views\dashboard.py

找到该类 

class Dashboard(CommAdminView):
然后修改如下
找到该函数
@filter_hook 
def get_widgets(self):
修改如下:
# 屏蔽掉原本只能获取用户自定义的组件,更改为获取唯一的一个组件 user_obj = User.objects.get(username=SUPER_USERNAME)
portal_pos = UserSettings.objects.filter(user=user_obj) if len(portal_pos):
    portal_pos = portal_pos[0].value
    widgets = [] if portal_pos:
        user_widgets = dict([(uw.id, uw) for uw in UserWidget.objects.filter(page_id=self.get_page_id())]) for col in portal_pos.split('|'):
            ws = [] for wid in col.split(','): try:
                    widget = user_widgets.get(int(wid)) if widget:
                        ws.append(self.get_widget(widget)) except Exception as e: import logging
                    logging.error(e, exc_info=True)
            widgets.append(ws) return widgets
截图如下
 

原创文章,转载请注明出处:http://124.221.219.47/article/xadminweidit/