mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #12896. Documented the new side-effects of ModelForm validation.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12693 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
90616a77f0
commit
fa6c967438
2 changed files with 23 additions and 0 deletions
|
@ -196,6 +196,19 @@ we'll discuss in a moment.)::
|
|||
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
|
||||
---------------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue