def bootstrap_messages(context, *args, **kwargs):
"""
Show django.contrib.messages Messages in Bootstrap alert containers.
In order to make the alerts dismissable (with the close button),
we have to set the jquery parameter too when using the
bootstrap_javascript tag.
Uses the template ``bootstrap3/messages.html``.
**Tag name**::
bootstrap_messages
**Parameters**:
None.
**Usage**::
{% bootstrap_messages %}
**Example**::
{% bootstrap_javascript jquery=1 %}
{% bootstrap_messages %}
"""
# Force Django 1.8+ style, so dicts and not Context
# TODO: This may be due to a bug in Django 1.8/1.9+
if Context and isinstance(context, Context):
context = context.flatten()
context.update({'message_constants': message_constants})
return render_template_file('bootstrap3/messages.html', context=context)
评论列表
文章目录