mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts: django/db/backends/oracle/base.py django/db/backends/postgresql_psycopg2/base.py django/db/models/signals.py tests/queries/tests.py
This commit is contained in:
@@ -104,14 +104,9 @@ aren't present on your form from being validated since any errors raised could
|
||||
not be corrected by the user.
|
||||
|
||||
Note that ``full_clean()`` will *not* be called automatically when you call
|
||||
your model's :meth:`~Model.save()` method, nor as a result of
|
||||
:class:`~django.forms.ModelForm` validation. In the case of
|
||||
:class:`~django.forms.ModelForm` validation, :meth:`Model.clean_fields()`,
|
||||
:meth:`Model.clean()`, and :meth:`Model.validate_unique()` are all called
|
||||
individually.
|
||||
|
||||
You'll need to call ``full_clean`` manually when you want to run one-step model
|
||||
validation for your own manually created models. For example::
|
||||
your model's :meth:`~Model.save()` method. You'll need to call it manually
|
||||
when you want to run one-step model validation for your own manually created
|
||||
models. For example::
|
||||
|
||||
from django.core.exceptions import ValidationError
|
||||
try:
|
||||
@@ -526,6 +521,25 @@ For example::
|
||||
In previous versions only instances of the exact same class and same
|
||||
primary key value were considered equal.
|
||||
|
||||
``__hash__``
|
||||
------------
|
||||
|
||||
.. method:: Model.__hash__()
|
||||
|
||||
The ``__hash__`` method is based on the instance's primary key value. It
|
||||
is effectively hash(obj.pk). If the instance doesn't have a primary key
|
||||
value then a ``TypeError`` will be raised (otherwise the ``__hash__``
|
||||
method would return different values before and after the instance is
|
||||
saved, but changing the ``__hash__`` value of an instance `is forbidden
|
||||
in Python`_).
|
||||
|
||||
.. versionchanged:: 1.7
|
||||
|
||||
In previous versions instance's without primary key value were
|
||||
hashable.
|
||||
|
||||
.. _is forbidden in Python: http://docs.python.org/reference/datamodel.html#object.__hash__
|
||||
|
||||
``get_absolute_url``
|
||||
--------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user