Media' object has no attribute 'add_css

'Media' object has no attribute 'add_css'
Request Method:     GET
Request URL:     http://localhost:8000/xadmin/
Django Version:     2.0.1
Exception Type:     AttributeError
Exception Value:     
'Media' object has no attribute 'add_css'
Exception Location:     /home/wuchao/PycharmProjects/mxonline3/extra_apps/xadmin/util.py in vendor, line 94
解决方案
将util.py 中的86行

def vendor(*tags):方法体改为:
    css = {'screen': []}
    js = []
    for tag in tags:
        file_type = tag.split('.')[-1]
        files = xstatic(tag)
        if file_type == 'js':
            js.extend(files)
        elif file_type == 'css':
            css['screen'] += files
    return Media(css=css, js=js)

posted @ 2022-09-14 18:38  tslam  阅读(86)  评论(0编辑  收藏  举报