Editing Django _form.as_p

前端 未结 5 1363
名媛妹妹
名媛妹妹 2021-02-02 11:38

By default _form.as._p spits out:

5条回答
  •  梦如初夏
    2021-02-02 12:16

    You simply just can't use form.as_p anymore. If the defaults don't work for you, then you must render the fields manually:

    {% for field in form %}
    {{ field.errors }} {{ field.label_tag }}: {{ field }}
    {% endfor %}

    See the docs: https://docs.djangoproject.com/en/dev/topics/forms/#looping-over-the-form-s-fields

提交回复
热议问题