crispy_forms_filters.py 文件源码

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

项目:mes 作者: osess 项目源码 文件源码
def as_crispy_errors(form, template_pack=TEMPLATE_PACK):
    """
    Renders only form errors the same way as django-crispy-forms::

        {% load crispy_forms_tags %}
        {{ form|as_crispy_errors }}

    or::

        {{ form|as_crispy_errors:"bootstrap" }}
    """
    if isinstance(form, BaseFormSet):
        template = get_template('%s/errors_formset.html' % template_pack)
        c = Context({'formset': form})
    else:
        template = get_template('%s/errors.html' % template_pack)
        c = Context({'form': form})
    return template.render(c)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号