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]
)
评论列表
文章目录