首页
官方文档中Media 自定义引入js和css的方法错误

官方文档中Media 自定义引入js和css的方法错误

2020-04-13 15:11:56
822
4

文档示例: 引发错误:


正确示例:


源码:

    def render_css(self):
        # To keep rendering order consistent, we can't just iterate over items().
        # We need to sort the keys, and iterate over the sorted list.
        media = sorted(self._css)
        return chain.from_iterable([
            format_html(
                '<link href="{}" type="text/css" media="{}" rel="stylesheet">',
                self.absolute_path(path), medium
            ) for path in self._css[medium]
        ] for medium in media)
评论(4)