diff options
| author | Tim Graham <timograham@gmail.com> | 2016-05-08 18:07:43 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-05-08 18:07:43 -0400 |
| commit | f5ff5010cd74500785a707ac70b51d292403cddc (patch) | |
| tree | 4feba4343be64658742341f0498b599add0c7834 /docs/ref/models | |
| parent | 413f3bb5c8f29fae08de58d5424b2be185739b32 (diff) | |
Fixed #26483 -- Updated docs.python.org links to use Intersphinx.
Diffstat (limited to 'docs/ref/models')
| -rw-r--r-- | docs/ref/models/instances.txt | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt index e63db64ae0..1dce85794c 100644 --- a/docs/ref/models/instances.txt +++ b/docs/ref/models/instances.txt @@ -599,8 +599,8 @@ Other model instance methods A few object methods have special purposes. -``__str__`` ------------ +``__str__()`` +------------- .. method:: Model.__str__() @@ -626,8 +626,8 @@ For example:: If you'd like compatibility with Python 2, you can decorate your model class with :func:`~django.utils.encoding.python_2_unicode_compatible` as shown above. -``__eq__`` ----------- +``__eq__()`` +------------ .. method:: Model.__eq__() @@ -655,22 +655,20 @@ For example:: MyModel(id=1) != MultitableInherited(id=1) MyModel(id=1) != MyModel(id=2) -``__hash__`` ------------- +``__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__`` +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`_). - -.. _is forbidden in Python: https://docs.python.org/reference/datamodel.html#object.__hash__ +saved, but changing the :meth:`~object.__hash__` value of an instance is +forbidden in Python. -``get_absolute_url`` --------------------- +``get_absolute_url()`` +---------------------- .. method:: Model.get_absolute_url() |
