mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Removed versionadded/changed notes for 1.7.
This commit is contained in:
@@ -17,10 +17,6 @@ Django supports addition, subtraction, multiplication, division, modulo
|
||||
arithmetic, and the power operator on query expressions, using Python constants,
|
||||
variables, and even other expressions.
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
||||
Support for the power operator ``**`` was added.
|
||||
|
||||
Some examples
|
||||
=============
|
||||
|
||||
|
||||
@@ -156,8 +156,6 @@ This lets you construct choices dynamically. But if you find yourself hacking
|
||||
database table with a :class:`ForeignKey`. :attr:`~Field.choices` is meant for
|
||||
static data that doesn't change much, if ever.
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
||||
Unless :attr:`blank=False<Field.blank>` is set on the field along with a
|
||||
:attr:`~Field.default` then a label containing ``"---------"`` will be rendered
|
||||
with the select box. To override this behavior, add a tuple to ``choices``
|
||||
@@ -241,10 +239,6 @@ Error message keys include ``null``, ``blank``, ``invalid``, ``invalid_choice``,
|
||||
``unique``, and ``unique_for_date``. Additional error message keys are
|
||||
specified for each field in the `Field types`_ section below.
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
||||
The ``unique_for_date`` error message key was added.
|
||||
|
||||
``help_text``
|
||||
-------------
|
||||
|
||||
@@ -592,10 +586,6 @@ Has two optional arguments:
|
||||
|
||||
.. attribute:: FileField.upload_to
|
||||
|
||||
.. versionchanged:: 1.7
|
||||
|
||||
``upload_to`` was required in older versions of Django.
|
||||
|
||||
A local filesystem path that will be appended to your :setting:`MEDIA_ROOT`
|
||||
setting to determine the value of the
|
||||
:attr:`~django.db.models.fields.files.FieldFile.url` attribute.
|
||||
@@ -987,12 +977,10 @@ databases supported by Django.
|
||||
A large text field. The default form widget for this field is a
|
||||
:class:`~django.forms.Textarea`.
|
||||
|
||||
.. versionchanged:: 1.7
|
||||
|
||||
If you specify a ``max_length`` attribute, it will be reflected in the
|
||||
:class:`~django.forms.Textarea` widget of the auto-generated form field.
|
||||
However it is not enforced at the model or database level. Use a
|
||||
:class:`CharField` for that.
|
||||
If you specify a ``max_length`` attribute, it will be reflected in the
|
||||
:class:`~django.forms.Textarea` widget of the auto-generated form field.
|
||||
However it is not enforced at the model or database level. Use a
|
||||
:class:`CharField` for that.
|
||||
|
||||
.. admonition:: MySQL users
|
||||
|
||||
@@ -1156,11 +1144,6 @@ define the details of how the relation works.
|
||||
:attr:`~django.contrib.admin.ModelAdmin.raw_id_fields` in the
|
||||
``ModelAdmin`` for the model.
|
||||
|
||||
.. versionchanged:: 1.7
|
||||
|
||||
Previous versions of Django do not allow passing a callable as a value
|
||||
for ``limit_choices_to``.
|
||||
|
||||
.. note::
|
||||
|
||||
If a callable is used for ``limit_choices_to``, it will be invoked
|
||||
@@ -1280,8 +1263,6 @@ The possible values for :attr:`~ForeignKey.on_delete` are found in
|
||||
|
||||
.. attribute:: ForeignKey.swappable
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
||||
Controls the migration framework's reaction if this :class:`ForeignKey`
|
||||
is pointing at a swappable model. If it is ``True`` - the default -
|
||||
then if the :class:`ForeignKey` is pointing at a model which matches
|
||||
@@ -1400,8 +1381,6 @@ that control how the relationship functions.
|
||||
|
||||
.. attribute:: ManyToManyField.through_fields
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
||||
Only used when a custom intermediary model is specified. Django will
|
||||
normally determine which fields of the intermediary model to use in order
|
||||
to establish a many-to-many relationship automatically. However,
|
||||
@@ -1470,8 +1449,6 @@ that control how the relationship functions.
|
||||
|
||||
.. attribute:: ManyToManyField.swappable
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
||||
Controls the migration framework's reaction if this :class:`ManyToManyField`
|
||||
is pointing at a swappable model. If it is ``True`` - the default -
|
||||
then if the :class:`ManyToManyField` is pointing at a model which matches
|
||||
@@ -1699,8 +1676,6 @@ Field API reference
|
||||
``"year"``, ``"month"``, ``"day"``, ``"isnull"``, ``"search"``,
|
||||
``"regex"``, and ``"iregex"``.
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
||||
If you are using :doc:`Custom lookups </ref/models/lookups>` the
|
||||
``lookup_type`` can be any ``lookup_name`` registered in the field.
|
||||
|
||||
@@ -1752,8 +1727,6 @@ Field API reference
|
||||
|
||||
.. method:: deconstruct()
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
||||
Returns a 4-tuple with enough information to recreate the field:
|
||||
|
||||
1. The name of the field on the model.
|
||||
|
||||
@@ -683,11 +683,6 @@ For example::
|
||||
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.
|
||||
|
||||
``__hash__``
|
||||
------------
|
||||
|
||||
@@ -700,11 +695,6 @@ 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: https://docs.python.org/reference/datamodel.html#object.__hash__
|
||||
|
||||
``get_absolute_url``
|
||||
|
||||
@@ -7,8 +7,6 @@ Lookup API reference
|
||||
|
||||
.. currentmodule:: django.db.models
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
||||
This document has the API references of lookups, the Django API for building
|
||||
the ``WHERE`` clause of a database query. To learn how to *use* lookups, see
|
||||
:doc:`/topics/db/queries`; to learn how to *create* new lookups, see
|
||||
|
||||
@@ -24,17 +24,12 @@ Available ``Meta`` options
|
||||
|
||||
.. attribute:: Options.app_label
|
||||
|
||||
If a model exists outside of the standard locations (:file:`models.py` or
|
||||
a ``models`` package in an app), the model must define which app it is part
|
||||
of::
|
||||
If a model exists outside of an application in :setting:`INSTALLED_APPS` or
|
||||
if it's imported before its application was loaded, it must define which
|
||||
app it is part of::
|
||||
|
||||
app_label = 'myapp'
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
||||
``app_label`` is no longer required for models that are defined
|
||||
outside the ``models`` module of an application.
|
||||
|
||||
``db_table``
|
||||
------------
|
||||
|
||||
@@ -275,8 +270,6 @@ Django quotes column and table names behind the scenes.
|
||||
|
||||
.. attribute:: Options.default_permissions
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
||||
Defaults to ``('add', 'change', 'delete')``. You may customize this list,
|
||||
for example, by setting this to an empty list if your app doesn't require
|
||||
any of the default permissions. It must be specified on the model before
|
||||
@@ -336,10 +329,8 @@ Django quotes column and table names behind the scenes.
|
||||
:class:`~django.db.models.ManyToManyField`, try using a signal or
|
||||
an explicit :attr:`through <ManyToManyField.through>` model.
|
||||
|
||||
.. versionchanged:: 1.7
|
||||
|
||||
The ``ValidationError`` raised during model validation when the
|
||||
constraint is violated has the ``unique_together`` error code.
|
||||
The ``ValidationError`` raised during model validation when the constraint
|
||||
is violated has the ``unique_together`` error code.
|
||||
|
||||
``index_together``
|
||||
------------------
|
||||
@@ -355,8 +346,6 @@ Django quotes column and table names behind the scenes.
|
||||
This list of fields will be indexed together (i.e. the appropriate
|
||||
``CREATE INDEX`` statement will be issued.)
|
||||
|
||||
.. versionchanged:: 1.7
|
||||
|
||||
For convenience, ``index_together`` can be a single list when dealing with a single
|
||||
set of fields::
|
||||
|
||||
|
||||
@@ -329,11 +329,6 @@ the cost of a JOIN, by referring to the ``_id`` of the related field::
|
||||
# Join
|
||||
Entry.objects.order_by('blog__id')
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
||||
The ability to order a queryset by a related field, without incurring
|
||||
the cost of a JOIN was added.
|
||||
|
||||
You can also order by :doc:`query expressions </ref/models/expressions>` by
|
||||
calling ``asc()`` or ``desc()`` on the expression::
|
||||
|
||||
@@ -579,12 +574,6 @@ A few subtleties that are worth mentioning:
|
||||
* Calling :meth:`only()` and :meth:`defer()` after ``values()`` doesn't make
|
||||
sense, so doing so will raise a ``NotImplementedError``.
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
||||
The last point above is new. Previously, calling :meth:`only()` and
|
||||
:meth:`defer()` after ``values()`` was allowed, but it either crashed or
|
||||
returned incorrect results.
|
||||
|
||||
It is useful when you know you're only going to need values from a small number
|
||||
of the available fields and you won't need the functionality of a model
|
||||
instance object. It's more efficient to select only the fields you need to use.
|
||||
@@ -856,11 +845,6 @@ Chaining ``select_related`` calls works in a similar way to other methods -
|
||||
that is that ``select_related('foo', 'bar')`` is equivalent to
|
||||
``select_related('foo').select_related('bar')``.
|
||||
|
||||
.. versionchanged:: 1.7
|
||||
|
||||
Previously the latter would have been equivalent to
|
||||
``select_related('bar')``.
|
||||
|
||||
prefetch_related
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -1011,8 +995,6 @@ profile for your use case!
|
||||
Note that if you use ``iterator()`` to run the query, ``prefetch_related()``
|
||||
calls will be ignored since these two optimizations do not make sense together.
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
||||
You can use the :class:`~django.db.models.Prefetch` object to further control
|
||||
the prefetch operation.
|
||||
|
||||
@@ -1483,11 +1465,6 @@ a transaction outside of one.
|
||||
Using ``select_for_update()`` on backends which do not support
|
||||
``SELECT ... FOR UPDATE`` (such as SQLite) will have no effect.
|
||||
|
||||
.. versionchanged:: 1.6.3
|
||||
|
||||
It is now an error to execute a query with ``select_for_update()`` in
|
||||
autocommit mode. With earlier releases in the 1.6 series it was a no-op.
|
||||
|
||||
.. warning::
|
||||
|
||||
Although ``select_for_update()`` normally fails in autocommit mode, since
|
||||
@@ -1503,11 +1480,6 @@ raw
|
||||
|
||||
.. method:: raw(raw_query, params=None, translations=None)
|
||||
|
||||
.. versionchanged:: 1.7
|
||||
|
||||
``raw`` was moved to the ``QuerySet`` class. It was previously only on
|
||||
:class:`~django.db.models.Manager`.
|
||||
|
||||
Takes a raw SQL query, executes it, and returns a
|
||||
``django.db.models.query.RawQuerySet`` instance. This ``RawQuerySet`` instance
|
||||
can be iterated over just like an normal ``QuerySet`` to provide object instances.
|
||||
@@ -1703,8 +1675,6 @@ update_or_create
|
||||
|
||||
.. method:: update_or_create(defaults=None, **kwargs)
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
||||
A convenience method for updating an object with the given ``kwargs``, creating
|
||||
a new one if necessary. The ``defaults`` is a dictionary of (field, value)
|
||||
pairs used to update the object.
|
||||
@@ -2119,8 +2089,6 @@ as_manager
|
||||
|
||||
.. classmethod:: as_manager()
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
||||
Class method that returns an instance of :class:`~django.db.models.Manager`
|
||||
with a copy of the ``QuerySet``’s methods. See
|
||||
:ref:`create-manager-with-queryset-methods` for more details.
|
||||
@@ -2175,12 +2143,9 @@ SQL equivalents::
|
||||
iexact
|
||||
~~~~~~
|
||||
|
||||
Case-insensitive exact match.
|
||||
|
||||
.. versionchanged:: 1.7
|
||||
|
||||
If the value provided for comparison is ``None``, it will be interpreted
|
||||
as an SQL ``NULL`` (see :lookup:`isnull` for more details).
|
||||
Case-insensitive exact match. If the value provided for comparison is ``None``,
|
||||
it will be interpreted as an SQL ``NULL`` (see :lookup:`isnull` for more
|
||||
details).
|
||||
|
||||
Example::
|
||||
|
||||
@@ -2890,8 +2855,6 @@ in particular, it is not otherwise possible to use ``OR`` in ``QuerySets``.
|
||||
``Prefetch()`` objects
|
||||
----------------------
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
||||
.. class:: Prefetch(lookup, queryset=None, to_attr=None)
|
||||
|
||||
The ``Prefetch()`` object can be used to control the operation of
|
||||
|
||||
Reference in New Issue
Block a user