summaryrefslogtreecommitdiff
path: root/docs/ref/models
diff options
context:
space:
mode:
authorAndrew Godwin <andrew@aeracode.org>2013-08-23 12:36:53 +0100
committerAndrew Godwin <andrew@aeracode.org>2013-08-23 12:36:53 +0100
commit5569b0b92f0504aadf0376f9cf0cb09106cd3e92 (patch)
treee82fda531a8ef41e8a32054f4fe55eb288457994 /docs/ref/models
parent9cc6cfc4057e07b73a1d72a1177d568362b0c517 (diff)
parent57c82f909b212708a17edd11014be718bd02be3b (diff)
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
Diffstat (limited to 'docs/ref/models')
-rw-r--r--docs/ref/models/instances.txt30
1 files changed, 22 insertions, 8 deletions
diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt
index 015393a408..da657a9a01 100644
--- a/docs/ref/models/instances.txt
+++ b/docs/ref/models/instances.txt
@@ -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``
--------------------