Author: jkocherhans
Date: 2010-03-06 13:51:29 -0600 (Sat, 06 Mar 2010)
New Revision: 12693

Modified:
   django/trunk/docs/releases/1.2.txt
   django/trunk/docs/topics/forms/modelforms.txt
Log:
Fixed #12896. Documented the new side-effects of ModelForm validation.

Modified: django/trunk/docs/releases/1.2.txt
===================================================================
--- django/trunk/docs/releases/1.2.txt  2010-03-06 19:17:29 UTC (rev 12692)
+++ django/trunk/docs/releases/1.2.txt  2010-03-06 19:51:29 UTC (rev 12693)
@@ -299,7 +299,17 @@
 introduced since 1.1, including ``csrf_protect``, ``cache_control`` and 
anything
 created using ``decorator_from_middleware``.
 
+``ModelForm.is_valid()`` and ``ModelForm.errors``
+-------------------------------------------------
 
+Much of the validation work for ModelForms has been moved down to the model
+level. As a result, the first time you call ``ModelForm.is_valid()``, access
+``ModelForm.errors`` or otherwise trigger form validation, your model will be
+cleaned in-place. This conversion used to happen when the model was saved. If
+you need an unmodified instance of your model, you should pass a copy to the
+``ModelForm`` constructor.
+
+
 .. _deprecated-features-1.2:
 
 ``BooleanField`` on MySQL

Modified: django/trunk/docs/topics/forms/modelforms.txt
===================================================================
--- django/trunk/docs/topics/forms/modelforms.txt       2010-03-06 19:17:29 UTC 
(rev 12692)
+++ django/trunk/docs/topics/forms/modelforms.txt       2010-03-06 19:51:29 UTC 
(rev 12693)
@@ -196,6 +196,19 @@
         name = forms.CharField(max_length=100)
         authors = forms.ModelMultipleChoiceField(queryset=Author.objects.all())
 
+The ``is_valid()`` method and ``errors``
+----------------------------------------
+
+.. versionchanged:: 1.2
+
+The first time you call ``is_valid()`` or access the ``errors`` attribute of a
+``ModelForm`` has always triggered form validation, but as of Django 1.2, it
+will also trigger :ref:`model validation <validating-objects>`. This has the
+side-effect of cleaning the model you pass to the ``ModelForm`` constructor.
+For instance, calling ``is_valid()`` on your form will convert any date fields
+on your model to actual date objects.
+
+
 The ``save()`` method
 ---------------------
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to