bootstrap4.py 文件源码

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

项目:SSBW 作者: AythaE 项目源码 文件源码
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 ``bootstrap4/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('bootstrap4/messages.html', context=context)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号