From cbdda28208c9c2aea479d5a482ff27bf37869d34 Mon Sep 17 00:00:00 2001 From: Erik Romijn Date: Sat, 23 Aug 2014 10:27:33 +0200 Subject: [PATCH] Fixed #23075 -- Added documentation on novalidate attribute and made it default for admin Thanks to sehmaschine for the report and to Tim Graham for the review. --- django/contrib/admin/templates/admin/change_form.html | 2 +- django/contrib/admin/templates/admin/change_list.html | 2 +- docs/topics/forms/index.txt | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/django/contrib/admin/templates/admin/change_form.html b/django/contrib/admin/templates/admin/change_form.html index 0fc4a25138..fc1e810541 100644 --- a/django/contrib/admin/templates/admin/change_form.html +++ b/django/contrib/admin/templates/admin/change_form.html @@ -37,7 +37,7 @@ {% endif %}{% endif %} {% endblock %} -
{% csrf_token %}{% block form_top %}{% endblock %} +{% csrf_token %}{% block form_top %}{% endblock %}
{% if is_popup %}{% endif %} {% if to_field %}{% endif %} diff --git a/django/contrib/admin/templates/admin/change_list.html b/django/contrib/admin/templates/admin/change_list.html index 586942d174..ca0080e3be 100644 --- a/django/contrib/admin/templates/admin/change_list.html +++ b/django/contrib/admin/templates/admin/change_list.html @@ -81,7 +81,7 @@ {% endif %} {% endblock %} - {% csrf_token %} + {% csrf_token %} {% if cl.formset %}
{{ cl.formset.management_form }}
{% endif %} diff --git a/docs/topics/forms/index.txt b/docs/topics/forms/index.txt index 4df70ede46..2b0cfe6946 100644 --- a/docs/topics/forms/index.txt +++ b/docs/topics/forms/index.txt @@ -341,6 +341,16 @@ from that ``{{ form }}`` by Django's template language. directly tied to forms in templates, this tag is omitted from the following examples in this document. +.. admonition:: HTML5 input types and browser validation + + If your form includes a :class:`~django.forms.URLField`, an + :class:`~django.forms.EmailField` or any integer field type, Django will + use the ``url``, ``email`` and ``number`` HTML5 input types. By default, + browsers may apply their own validation on these fields, which may be + stricter than Django's validation. If you would like to disable this + behavior, set the `novalidate` attribute on the ``form`` tag, or specify + a different widget on the field, like :class:`TextInput`. + We now have a working web form, described by a Django :class:`Form`, processed by a view, and rendered as an HTML ````.