mirror of
https://github.com/django/django.git
synced 2024-12-25 02:26:12 +00:00
Fixed #22473 -- Emphasized that Model.clean() is not called from Model.save().
This commit is contained in:
parent
275811a93c
commit
b43bbd6d39
@ -143,6 +143,9 @@ access to more than a single field::
|
|||||||
if self.status == 'published' and self.pub_date is None:
|
if self.status == 'published' and self.pub_date is None:
|
||||||
self.pub_date = datetime.date.today()
|
self.pub_date = datetime.date.today()
|
||||||
|
|
||||||
|
Note, however, that like :meth:`Model.full_clean()`, a model's ``clean()``
|
||||||
|
method is not invoked when you call your model's :meth:`~Model.save()` method.
|
||||||
|
|
||||||
Any :exc:`~django.core.exceptions.ValidationError` exceptions raised by
|
Any :exc:`~django.core.exceptions.ValidationError` exceptions raised by
|
||||||
``Model.clean()`` will be stored in a special key error dictionary key,
|
``Model.clean()`` will be stored in a special key error dictionary key,
|
||||||
:data:`~django.core.exceptions.NON_FIELD_ERRORS`, that is used for errors
|
:data:`~django.core.exceptions.NON_FIELD_ERRORS`, that is used for errors
|
||||||
|
Loading…
Reference in New Issue
Block a user