Last active
December 19, 2015 19:58
-
-
Save loic/6009660 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The first time you call ``is_valid()`` or access the ``errors`` attribute of a | |
``ModelForm`` triggers :ref:`form validation <form-and-field-validation>` as | |
-well as :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. If form validation fails, only some of the updates | |
-may be applied. For this reason, you'll probably want to avoid reusing the | |
-model instance passed to the form, especially if validation fails. | |
+well as :ref:`model validation <validating-objects>`. | |
+ | |
+.. warning:: | |
+ | |
+ The cleaning process modifies the model instance passed to the | |
+ ``ModelForm`` constructor in various ways. For instance any date fields on | |
+ the model is converted into actual date objects. Failed validation may | |
+ leave the underlying model instance in an inconsistent state and for this | |
+ reason it's not recommended to reuse it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment