diff options
| author | Andrew Godwin <andrew@aeracode.org> | 2013-08-19 18:30:48 +0100 |
|---|---|---|
| committer | Andrew Godwin <andrew@aeracode.org> | 2013-08-19 18:30:48 +0100 |
| commit | b6a957f0ba8a2ed1b24d7ee042a9c4beaf51ab03 (patch) | |
| tree | 87d42b9e8d3d4c1516b53eee1d9332735762826a /docs/ref/models | |
| parent | 52edc16086e3c28a78c31975bb4da2f9450590b4 (diff) | |
| parent | 3c0300405009b82b52fd15483371097221662fcd (diff) | |
Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts:
docs/ref/django-admin.txt
Diffstat (limited to 'docs/ref/models')
| -rw-r--r-- | docs/ref/models/fields.txt | 11 | ||||
| -rw-r--r-- | docs/ref/models/instances.txt | 36 | ||||
| -rw-r--r-- | docs/ref/models/options.txt | 2 | ||||
| -rw-r--r-- | docs/ref/models/querysets.txt | 40 |
4 files changed, 47 insertions, 42 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index 01215884c4..a9673ce3d2 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -757,21 +757,16 @@ directory on the filesystem. Has three special arguments, of which the first is .. attribute:: FilePathField.allow_files - .. versionadded:: 1.5 - Optional. Either ``True`` or ``False``. Default is ``True``. Specifies whether files in the specified location should be included. Either this or :attr:`~FilePathField.allow_folders` must be ``True``. .. attribute:: FilePathField.allow_folders - .. versionadded:: 1.5 - Optional. Either ``True`` or ``False``. Default is ``False``. Specifies whether folders in the specified location should be included. Either this or :attr:`~FilePathField.allow_files` must be ``True``. - Of course, these arguments can be used together. The one potential gotcha is that :attr:`~FilePathField.match` applies to the @@ -980,12 +975,6 @@ Like all :class:`CharField` subclasses, :class:`URLField` takes the optional :attr:`~CharField.max_length` argument. If you don't specify :attr:`~CharField.max_length`, a default of 200 is used. -.. versionadded:: 1.5 - - The current value of the field will be displayed as a clickable link above the - input widget. - - Relationship fields =================== diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt index cb8570afdc..015393a408 100644 --- a/docs/ref/models/instances.txt +++ b/docs/ref/models/instances.txt @@ -388,8 +388,6 @@ For more details, see the documentation on :ref:`F() expressions Specifying which fields to save ------------------------------- -.. versionadded:: 1.5 - If ``save()`` is passed a list of field names in keyword argument ``update_fields``, only the fields named in that list will be updated. This may be desirable if you want to update just one or a few fields on @@ -494,6 +492,40 @@ using ``__str__()`` like this:: # first_name and last_name will be unicode strings. return force_bytes('%s %s' % (self.first_name, self.last_name)) +``__eq__`` +---------- + +.. method:: Model.__eq__() + +The equality method is defined such that instances with the same primary +key value and the same concrete class are considered equal. For proxy +models, concrete class is defined as the model's first non-proxy parent; +for all other models it is simply the model's class. + +For example:: + + form django.db import models + + class MyModel(models.Model): + id = models.AutoField(primary_key=True) + + class MyProxyModel(MyModel): + class Meta: + proxy = True + + class MultitableInherited(MyModel): + pass + + MyModel(id=1) == MyModel(id=1) + MyModel(id=1) == MyProxyModel(id=1) + MyModel(id=1) != MultitableInherited(id=1) + MyModel(id=1) != MyModel(id=2) + +.. versionchanged:: 1.7 + + In previous versions only instances of the exact same class and same + primary key value were considered equal. + ``get_absolute_url`` -------------------- diff --git a/docs/ref/models/options.txt b/docs/ref/models/options.txt index f49ba7a5c0..baa24f63cb 100644 --- a/docs/ref/models/options.txt +++ b/docs/ref/models/options.txt @@ -286,8 +286,6 @@ Django quotes column and table names behind the scenes. .. attribute:: Options.index_together - .. versionadded:: 1.5 - Sets of field names that, taken together, are indexed:: index_together = [ diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index 0f08022179..910f7d94d5 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -913,7 +913,7 @@ needed by ``select_related``), it is able to detect that the ``best_pizza`` objects have already been fetched, and it will skip fetching them again. Chaining ``prefetch_related`` calls will accumulate the lookups that are -prefetched. To clear any ``prefetch_related`` behavior, pass `None` as a +prefetched. To clear any ``prefetch_related`` behavior, pass ``None`` as a parameter:: >>> non_prefetched = qs.prefetch_related(None) @@ -1149,13 +1149,11 @@ to ``defer()``:: # Load all fields immediately. my_queryset.defer(None) -.. versionchanged:: 1.5 - - Some fields in a model won't be deferred, even if you ask for them. You can - never defer the loading of the primary key. If you are using - :meth:`select_related()` to retrieve related models, you shouldn't defer the - loading of the field that connects from the primary model to the related - one, doing so will result in an error. +Some fields in a model won't be deferred, even if you ask for them. You can +never defer the loading of the primary key. If you are using +:meth:`select_related()` to retrieve related models, you shouldn't defer the +loading of the field that connects from the primary model to the related +one, doing so will result in an error. .. note:: @@ -1178,8 +1176,6 @@ to ``defer()``:: reader, is slightly faster and consumes a little less memory in the Python process. -.. versionchanged:: 1.5 - .. note:: When calling :meth:`~django.db.models.Model.save()` for instances with @@ -1227,16 +1223,14 @@ All of the cautions in the note for the :meth:`defer` documentation apply to ``only()`` as well. Use it cautiously and only after exhausting your other options. -.. versionchanged:: 1.5 - - Using :meth:`only` and omitting a field requested using - :meth:`select_related` is an error as well. +Using :meth:`only` and omitting a field requested using :meth:`select_related` +is an error as well. - .. note:: +.. note:: - When calling :meth:`~django.db.models.Model.save()` for instances with - deferred fields, only the loaded fields will be saved. See - :meth:`~django.db.models.Model.save()` for more details. + When calling :meth:`~django.db.models.Model.save()` for instances with + deferred fields, only the loaded fields will be saved. See + :meth:`~django.db.models.Model.save()` for more details. using ~~~~~ @@ -1567,10 +1561,6 @@ The ``batch_size`` parameter controls how many objects are created in single query. The default is to create all objects in one batch, except for SQLite where the default is such that at maximum 999 variables per query is used. -.. versionadded:: 1.5 - - The ``batch_size`` parameter was added in version 1.5. - count ~~~~~ @@ -1900,10 +1890,6 @@ methods on your models. It does, however, emit the :data:`~django.db.models.signals.post_delete` signals for all deleted objects (including cascaded deletions). -.. versionadded:: 1.5 - - Allow fast-path deletion of objects. - Django needs to fetch objects into memory to send signals and handle cascades. However, if there are no cascades and no signals, then Django may take a fast-path and delete objects without fetching into memory. For large @@ -1911,7 +1897,7 @@ deletes this can result in significantly reduced memory usage. The amount of executed queries can be reduced, too. ForeignKeys which are set to :attr:`~django.db.models.ForeignKey.on_delete` -DO_NOTHING do not prevent taking the fast-path in deletion. +``DO_NOTHING`` do not prevent taking the fast-path in deletion. Note that the queries generated in object deletion is an implementation detail subject to change. |
