Kaydet (Commit) 38d60c39 authored tarafından Timo Graham's avatar Timo Graham

Fixed #13949 - Note that readonly fields can't be modified via custom clean…

Fixed #13949 - Note that readonly fields can't be modified via custom clean methods. thanks alk for the suggestion and elbarto and Gabriel Hurley whose language I used in the final patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15060 bcc190cf-cafb-0310-a4f2-bffc1f526a37
üst 4b2b2eda
...@@ -139,7 +139,11 @@ While you could access ``request.POST`` directly at this point, it is better to ...@@ -139,7 +139,11 @@ While you could access ``request.POST`` directly at this point, it is better to
access ``form.cleaned_data``. This data has not only been validated but will access ``form.cleaned_data``. This data has not only been validated but will
also be converted in to the relevant Python types for you. In the above example, also be converted in to the relevant Python types for you. In the above example,
``cc_myself`` will be a boolean value. Likewise, fields such as ``IntegerField`` ``cc_myself`` will be a boolean value. Likewise, fields such as ``IntegerField``
and ``FloatField`` convert values to a Python int and float respectively. and ``FloatField`` convert values to a Python int and float respectively. Note
that read-only fields are not available in ``form.cleaned_data`` (and setting
a value in a custom ``clean()`` method won't have any effect) because these
fields are displayed as text rather than as input elements, and thus are not
posted back to the server.
Extending the above example, here's how the form data could be processed: Extending the above example, here's how the form data could be processed:
...@@ -390,5 +394,5 @@ This covers the basics, but forms can do a whole lot more: ...@@ -390,5 +394,5 @@ This covers the basics, but forms can do a whole lot more:
.. seealso:: .. seealso::
:doc:`The Forms Reference </ref/forms/index>` :doc:`The Forms Reference </ref/forms/index>`
Covers the full API reference, including form fields, form widgets, Covers the full API reference, including form fields, form widgets,
and form and field validation. and form and field validation.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment