utils.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:extractfacts 作者: oneroyalace 项目源码 文件源码
def as_html(self):
        '''
        Render to HTML tag attributes.

        Example:

        .. code-block:: python

            >>> from django_tables2.utils import AttributeDict
            >>> attrs = AttributeDict({'class': 'mytable', 'id': 'someid'})
            >>> attrs.as_html()
            'class="mytable" id="someid"'

        :rtype: `~django.utils.safestring.SafeUnicode` object

        '''

        blacklist = ('th', 'td', '_ordering')
        return format_html_join(
            ' ', '{}="{}"',
            [(k, v) for k, v in six.iteritems(self) if k not in blacklist]
        )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号