Removed versionadded/changed annotations for 2.1.
This commit is contained in:
parent
eb0ce6fa36
commit
ec7e179aeb
|
@ -148,11 +148,6 @@ And on databases that support distinct on fields (such as PostgreSQL),
|
||||||
|
|
||||||
SELECT ... DISTINCT ON ABS("experiments"."change")
|
SELECT ... DISTINCT ON ABS("experiments"."change")
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
Ordering and distinct support as described in the last two paragraphs was
|
|
||||||
added.
|
|
||||||
|
|
||||||
When looking for which lookups are allowable after the ``Transform`` has been
|
When looking for which lookups are allowable after the ``Transform`` has been
|
||||||
applied, Django uses the ``output_field`` attribute. We didn't need to specify
|
applied, Django uses the ``output_field`` attribute. We didn't need to specify
|
||||||
this here as it didn't change, but supposing we were applying ``AbsoluteValue``
|
this here as it didn't change, but supposing we were applying ``AbsoluteValue``
|
||||||
|
|
|
@ -144,12 +144,6 @@ decorator on your :meth:`~BaseCommand.handle` method::
|
||||||
Since translation deactivation requires access to configured settings, the
|
Since translation deactivation requires access to configured settings, the
|
||||||
decorator can't be used for commands that work without configured settings.
|
decorator can't be used for commands that work without configured settings.
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
The ``@no_translations`` decorator is new. In older versions, translations
|
|
||||||
are deactivated before running a command unless the command's
|
|
||||||
``leave_locale_alone`` attribute (now removed) is set to ``True``.
|
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
=======
|
=======
|
||||||
|
|
||||||
|
|
|
@ -361,8 +361,6 @@ Conditionally enabling or disabling actions
|
||||||
Setting permissions for actions
|
Setting permissions for actions
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
Actions may limit their availability to users with specific permissions by
|
Actions may limit their availability to users with specific permissions by
|
||||||
setting an ``allowed_permissions`` attribute on the action function::
|
setting an ``allowed_permissions`` attribute on the action function::
|
||||||
|
|
||||||
|
|
|
@ -157,8 +157,6 @@ application and imports it.
|
||||||
|
|
||||||
.. attribute:: default_site
|
.. attribute:: default_site
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
A dotted import path to the default admin site's class or to a callable
|
A dotted import path to the default admin site's class or to a callable
|
||||||
that returns a site instance. Defaults to
|
that returns a site instance. Defaults to
|
||||||
``'django.contrib.admin.sites.AdminSite'``. See
|
``'django.contrib.admin.sites.AdminSite'``. See
|
||||||
|
@ -754,10 +752,6 @@ subclass::
|
||||||
return self.first_name + ' ' + self.last_name
|
return self.first_name + ' ' + self.last_name
|
||||||
full_name.admin_order_field = Concat('first_name', Value(' '), 'last_name')
|
full_name.admin_order_field = Concat('first_name', Value(' '), 'last_name')
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
Support for expressions in ``admin_order_field`` was added.
|
|
||||||
|
|
||||||
* Elements of ``list_display`` can also be properties. Please note however,
|
* Elements of ``list_display`` can also be properties. Please note however,
|
||||||
that due to the way properties work in Python, setting
|
that due to the way properties work in Python, setting
|
||||||
``short_description`` on a property is only possible when using the
|
``short_description`` on a property is only possible when using the
|
||||||
|
@ -1279,10 +1273,6 @@ subclass::
|
||||||
searching with :lookup:`exact` only works with a single search word since
|
searching with :lookup:`exact` only works with a single search word since
|
||||||
two or more words can't all be an exact match unless all words are the same.
|
two or more words can't all be an exact match unless all words are the same.
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
The ability to specify a field lookup was added.
|
|
||||||
|
|
||||||
Some (older) shortcuts for specifying a field lookup are also available.
|
Some (older) shortcuts for specifying a field lookup are also available.
|
||||||
You can prefix a field in ``search_fields`` with the following characters
|
You can prefix a field in ``search_fields`` with the following characters
|
||||||
and it's equivalent to adding ``__<lookup>`` to the field:
|
and it's equivalent to adding ``__<lookup>`` to the field:
|
||||||
|
@ -1313,8 +1303,6 @@ subclass::
|
||||||
|
|
||||||
.. attribute:: ModelAdmin.sortable_by
|
.. attribute:: ModelAdmin.sortable_by
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
By default, the change list page allows sorting by all model fields (and
|
By default, the change list page allows sorting by all model fields (and
|
||||||
callables that have the ``admin_order_field`` property) specified in
|
callables that have the ``admin_order_field`` property) specified in
|
||||||
:attr:`list_display`.
|
:attr:`list_display`.
|
||||||
|
@ -1433,8 +1421,6 @@ templates used by the :class:`ModelAdmin` views:
|
||||||
|
|
||||||
.. method:: ModelAdmin.delete_queryset(request, queryset)
|
.. method:: ModelAdmin.delete_queryset(request, queryset)
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
The ``delete_queryset()`` method is given the ``HttpRequest`` and a
|
The ``delete_queryset()`` method is given the ``HttpRequest`` and a
|
||||||
``QuerySet`` of objects to be deleted. Override this method to customize
|
``QuerySet`` of objects to be deleted. Override this method to customize
|
||||||
the deletion process for the "delete selected objects" :doc:`action
|
the deletion process for the "delete selected objects" :doc:`action
|
||||||
|
@ -1595,8 +1581,6 @@ templates used by the :class:`ModelAdmin` views:
|
||||||
|
|
||||||
.. method:: ModelAdmin.get_sortable_by(request)
|
.. method:: ModelAdmin.get_sortable_by(request)
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
The ``get_sortable_by()`` method is passed the ``HttpRequest`` and is
|
The ``get_sortable_by()`` method is passed the ``HttpRequest`` and is
|
||||||
expected to return a collection (e.g. ``list``, ``tuple``, or ``set``) of
|
expected to return a collection (e.g. ``list``, ``tuple``, or ``set``) of
|
||||||
field names that will be sortable in the change list page.
|
field names that will be sortable in the change list page.
|
||||||
|
@ -1884,8 +1868,6 @@ templates used by the :class:`ModelAdmin` views:
|
||||||
|
|
||||||
.. method:: ModelAdmin.has_view_permission(request, obj=None)
|
.. method:: ModelAdmin.has_view_permission(request, obj=None)
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
Should return ``True`` if viewing ``obj`` is permitted, ``False`` otherwise.
|
Should return ``True`` if viewing ``obj`` is permitted, ``False`` otherwise.
|
||||||
If obj is ``None``, should return ``True`` or ``False`` to indicate whether
|
If obj is ``None``, should return ``True`` or ``False`` to indicate whether
|
||||||
viewing of objects of this type is permitted in general (e.g., ``False``
|
viewing of objects of this type is permitted in general (e.g., ``False``
|
||||||
|
@ -2009,8 +1991,6 @@ templates used by the :class:`ModelAdmin` views:
|
||||||
|
|
||||||
.. method:: ModelAdmin.get_deleted_objects(objs, request)
|
.. method:: ModelAdmin.get_deleted_objects(objs, request)
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
A hook for customizing the deletion process of the :meth:`delete_view` and
|
A hook for customizing the deletion process of the :meth:`delete_view` and
|
||||||
the "delete selected" :doc:`action <actions>`.
|
the "delete selected" :doc:`action <actions>`.
|
||||||
|
|
||||||
|
@ -2128,10 +2108,6 @@ To avoid conflicts with user-supplied scripts or libraries, Django's jQuery
|
||||||
in your own admin JavaScript without including a second copy, you can use the
|
in your own admin JavaScript without including a second copy, you can use the
|
||||||
``django.jQuery`` object on changelist and add/edit views.
|
``django.jQuery`` object on changelist and add/edit views.
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
jQuery was upgraded from 2.2.3 to 3.3.1.
|
|
||||||
|
|
||||||
The :class:`ModelAdmin` class requires jQuery by default, so there is no need
|
The :class:`ModelAdmin` class requires jQuery by default, so there is no need
|
||||||
to add jQuery to your ``ModelAdmin``’s list of media resources unless you have
|
to add jQuery to your ``ModelAdmin``’s list of media resources unless you have
|
||||||
a specific need. For example, if you require the jQuery library to be in the
|
a specific need. For example, if you require the jQuery library to be in the
|
||||||
|
@ -2411,12 +2387,6 @@ The ``InlineModelAdmin`` class adds or customizes:
|
||||||
otherwise. ``obj`` is the parent object being edited or ``None`` when
|
otherwise. ``obj`` is the parent object being edited or ``None`` when
|
||||||
adding a new parent.
|
adding a new parent.
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
The ``obj`` argument was added. During the deprecation period, it may
|
|
||||||
also be ``None`` if third-party calls to ``has_add_permission()`` don't
|
|
||||||
provide it.
|
|
||||||
|
|
||||||
.. method:: InlineModelAdmin.has_change_permission(request, obj=None)
|
.. method:: InlineModelAdmin.has_change_permission(request, obj=None)
|
||||||
|
|
||||||
Should return ``True`` if editing an inline object is permitted, ``False``
|
Should return ``True`` if editing an inline object is permitted, ``False``
|
||||||
|
@ -2726,13 +2696,6 @@ app or per model. The following can:
|
||||||
* ``search_form.html``
|
* ``search_form.html``
|
||||||
* ``submit_line.html``
|
* ``submit_line.html``
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
The ability to override the ``actions.html``, ``change_form_object_tools.html``,
|
|
||||||
``change_list_object_tools.html``, ``change_list_results.html``,
|
|
||||||
``date_hierarchy.html``, ``pagination.html``, ``prepopulated_fields_js.html``,
|
|
||||||
``search_form.html``, and ``submit_line.html`` templates was added.
|
|
||||||
|
|
||||||
For those templates that cannot be overridden in this way, you may still
|
For those templates that cannot be overridden in this way, you may still
|
||||||
override them for your entire project. Just place the new version in your
|
override them for your entire project. Just place the new version in your
|
||||||
``templates/admin`` directory. This is particularly useful to create custom 404
|
``templates/admin`` directory. This is particularly useful to create custom 404
|
||||||
|
@ -2967,8 +2930,6 @@ put ``'django.contrib.admin.apps.SimpleAdminConfig'`` instead of
|
||||||
Overriding the default admin site
|
Overriding the default admin site
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
You can override the default ``django.contrib.admin.site`` by setting the
|
You can override the default ``django.contrib.admin.site`` by setting the
|
||||||
:attr:`~.SimpleAdminConfig.default_site` attribute of a custom ``AppConfig``
|
:attr:`~.SimpleAdminConfig.default_site` attribute of a custom ``AppConfig``
|
||||||
to the dotted import path of either a ``AdminSite`` subclass or a callable that
|
to the dotted import path of either a ``AdminSite`` subclass or a callable that
|
||||||
|
|
|
@ -210,14 +210,6 @@ Methods
|
||||||
:meth:`~django.contrib.auth.models.User.set_unusable_password()` has
|
:meth:`~django.contrib.auth.models.User.set_unusable_password()` has
|
||||||
been called for this user.
|
been called for this user.
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
In older versions, this also returns ``False`` if the password is
|
|
||||||
``None`` or an empty string, or if the password uses a hasher
|
|
||||||
that's not in the :setting:`PASSWORD_HASHERS` setting. That
|
|
||||||
behavior is considered a bug as it prevents users with such
|
|
||||||
passwords from requesting a password reset.
|
|
||||||
|
|
||||||
.. method:: get_group_permissions(obj=None)
|
.. method:: get_group_permissions(obj=None)
|
||||||
|
|
||||||
Returns a set of permission strings that the user has, through their
|
Returns a set of permission strings that the user has, through their
|
||||||
|
|
|
@ -283,8 +283,6 @@ representing the bounding box of the geometry.
|
||||||
|
|
||||||
.. class:: ForcePolygonCW(expression, **extra)
|
.. class:: ForcePolygonCW(expression, **extra)
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
*Availability*: `PostGIS <https://postgis.net/docs/ST_ForcePolygonCW.html>`__,
|
*Availability*: `PostGIS <https://postgis.net/docs/ST_ForcePolygonCW.html>`__,
|
||||||
SpatiaLite
|
SpatiaLite
|
||||||
|
|
||||||
|
|
|
@ -487,8 +487,6 @@ Topological Methods
|
||||||
|
|
||||||
.. method:: GEOSGeometry.buffer_with_style(width, quadsegs=8, end_cap_style=1, join_style=1, mitre_limit=5.0)
|
.. method:: GEOSGeometry.buffer_with_style(width, quadsegs=8, end_cap_style=1, join_style=1, mitre_limit=5.0)
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
Same as :meth:`buffer`, but allows customizing the style of the buffer.
|
Same as :meth:`buffer`, but allows customizing the style of the buffer.
|
||||||
|
|
||||||
* ``end_cap_style`` can be round (``1``), flat (``2``), or square (``3``).
|
* ``end_cap_style`` can be round (``1``), flat (``2``), or square (``3``).
|
||||||
|
|
|
@ -577,12 +577,6 @@ To query for missing keys, use the ``isnull`` lookup::
|
||||||
>>> Dog.objects.filter(data__owner__isnull=True)
|
>>> Dog.objects.filter(data__owner__isnull=True)
|
||||||
<QuerySet [<Dog: Shep>]>
|
<QuerySet [<Dog: Shep>]>
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
In older versions, using ``None`` as a lookup value matches objects that
|
|
||||||
don't have the key rather than objects that have the key with a ``None``
|
|
||||||
value.
|
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
Since any string could be a key in a JSON object, any lookup other than
|
Since any string could be a key in a JSON object, any lookup other than
|
||||||
|
|
|
@ -432,8 +432,6 @@ Only support for PostgreSQL is implemented.
|
||||||
|
|
||||||
.. django-admin-option:: --include-views
|
.. django-admin-option:: --include-views
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
If this option is provided, models are also created for database views.
|
If this option is provided, models are also created for database views.
|
||||||
|
|
||||||
``loaddata``
|
``loaddata``
|
||||||
|
|
|
@ -535,8 +535,6 @@ Usage example::
|
||||||
|
|
||||||
.. class:: TruncWeek(expression, output_field=None, tzinfo=None, **extra)
|
.. class:: TruncWeek(expression, output_field=None, tzinfo=None, **extra)
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
Truncates to midnight on the Monday of the week.
|
Truncates to midnight on the Monday of the week.
|
||||||
|
|
||||||
.. attribute:: kind = 'week'
|
.. attribute:: kind = 'week'
|
||||||
|
@ -1172,8 +1170,6 @@ Text functions
|
||||||
|
|
||||||
.. class:: Chr(expression, **extra)
|
.. class:: Chr(expression, **extra)
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
Accepts a numeric field or expression and returns the text representation of
|
Accepts a numeric field or expression and returns the text representation of
|
||||||
the expression as a single character. It works the same as Python's :func:`chr`
|
the expression as a single character. It works the same as Python's :func:`chr`
|
||||||
function.
|
function.
|
||||||
|
@ -1225,8 +1221,6 @@ Usage example::
|
||||||
|
|
||||||
.. class:: Left(expression, length, **extra)
|
.. class:: Left(expression, length, **extra)
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
Returns the first ``length`` characters of the given text field or expression.
|
Returns the first ``length`` characters of the given text field or expression.
|
||||||
|
|
||||||
Usage example::
|
Usage example::
|
||||||
|
@ -1287,8 +1281,6 @@ Usage example::
|
||||||
|
|
||||||
.. class:: LPad(expression, length, fill_text=Value(' '), **extra)
|
.. class:: LPad(expression, length, fill_text=Value(' '), **extra)
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
Returns the value of the given text field or expression padded on the left side
|
Returns the value of the given text field or expression padded on the left side
|
||||||
with ``fill_text`` so that the resulting value is ``length`` characters long.
|
with ``fill_text`` so that the resulting value is ``length`` characters long.
|
||||||
The default ``fill_text`` is a space.
|
The default ``fill_text`` is a space.
|
||||||
|
@ -1308,8 +1300,6 @@ Usage example::
|
||||||
|
|
||||||
.. class:: LTrim(expression, **extra)
|
.. class:: LTrim(expression, **extra)
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
Similar to :class:`~django.db.models.functions.Trim`, but removes only leading
|
Similar to :class:`~django.db.models.functions.Trim`, but removes only leading
|
||||||
spaces.
|
spaces.
|
||||||
|
|
||||||
|
@ -1318,8 +1308,6 @@ spaces.
|
||||||
|
|
||||||
.. class:: Ord(expression, **extra)
|
.. class:: Ord(expression, **extra)
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
Accepts a single text field or expression and returns the Unicode code point
|
Accepts a single text field or expression and returns the Unicode code point
|
||||||
value for the first character of that expression. It works similar to Python's
|
value for the first character of that expression. It works similar to Python's
|
||||||
:func:`ord` function, but an exception isn't raised if the expression is more
|
:func:`ord` function, but an exception isn't raised if the expression is more
|
||||||
|
@ -1341,8 +1329,6 @@ Usage example::
|
||||||
|
|
||||||
.. class:: Repeat(expression, number, **extra)
|
.. class:: Repeat(expression, number, **extra)
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
Returns the value of the given text field or expression repeated ``number``
|
Returns the value of the given text field or expression repeated ``number``
|
||||||
times.
|
times.
|
||||||
|
|
||||||
|
@ -1360,8 +1346,6 @@ Usage example::
|
||||||
|
|
||||||
.. class:: Replace(expression, text, replacement=Value(''), **extra)
|
.. class:: Replace(expression, text, replacement=Value(''), **extra)
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
Replaces all occurrences of ``text`` with ``replacement`` in ``expression``.
|
Replaces all occurrences of ``text`` with ``replacement`` in ``expression``.
|
||||||
The default replacement text is the empty string. The arguments to the function
|
The default replacement text is the empty string. The arguments to the function
|
||||||
are case-sensitive.
|
are case-sensitive.
|
||||||
|
@ -1403,8 +1387,6 @@ Usage example::
|
||||||
|
|
||||||
.. class:: Right(expression, length, **extra)
|
.. class:: Right(expression, length, **extra)
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
Returns the last ``length`` characters of the given text field or expression.
|
Returns the last ``length`` characters of the given text field or expression.
|
||||||
|
|
||||||
Usage example::
|
Usage example::
|
||||||
|
@ -1420,8 +1402,6 @@ Usage example::
|
||||||
|
|
||||||
.. class:: RPad(expression, length, fill_text=Value(' '), **extra)
|
.. class:: RPad(expression, length, fill_text=Value(' '), **extra)
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
Similar to :class:`~django.db.models.functions.LPad`, but pads on the right
|
Similar to :class:`~django.db.models.functions.LPad`, but pads on the right
|
||||||
side.
|
side.
|
||||||
|
|
||||||
|
@ -1430,8 +1410,6 @@ side.
|
||||||
|
|
||||||
.. class:: RTrim(expression, **extra)
|
.. class:: RTrim(expression, **extra)
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
Similar to :class:`~django.db.models.functions.Trim`, but removes only trailing
|
Similar to :class:`~django.db.models.functions.Trim`, but removes only trailing
|
||||||
spaces.
|
spaces.
|
||||||
|
|
||||||
|
@ -1491,8 +1469,6 @@ Usage example::
|
||||||
|
|
||||||
.. class:: Trim(expression, **extra)
|
.. class:: Trim(expression, **extra)
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
Returns the value of the given text field or expression with leading and
|
Returns the value of the given text field or expression with leading and
|
||||||
trailing spaces removed.
|
trailing spaces removed.
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,6 @@ Django supports negation, addition, subtraction, multiplication, division,
|
||||||
modulo arithmetic, and the power operator on query expressions, using Python
|
modulo arithmetic, and the power operator on query expressions, using Python
|
||||||
constants, variables, and even other expressions.
|
constants, variables, and even other expressions.
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
Support for negation was added.
|
|
||||||
|
|
||||||
Some examples
|
Some examples
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
|
|
@ -422,10 +422,6 @@ A field to store raw binary data. It can be assigned :class:`bytes`,
|
||||||
By default, ``BinaryField`` sets :attr:`~Field.editable` to ``False``, in which
|
By default, ``BinaryField`` sets :attr:`~Field.editable` to ``False``, in which
|
||||||
case it can't be included in a :class:`~django.forms.ModelForm`.
|
case it can't be included in a :class:`~django.forms.ModelForm`.
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
Older versions don't allow setting ``editable`` to ``True``.
|
|
||||||
|
|
||||||
``BinaryField`` has one extra optional argument:
|
``BinaryField`` has one extra optional argument:
|
||||||
|
|
||||||
.. attribute:: BinaryField.max_length
|
.. attribute:: BinaryField.max_length
|
||||||
|
@ -453,12 +449,6 @@ or :class:`~django.forms.NullBooleanSelect` if :attr:`null=True <Field.null>`.
|
||||||
The default value of ``BooleanField`` is ``None`` when :attr:`Field.default`
|
The default value of ``BooleanField`` is ``None`` when :attr:`Field.default`
|
||||||
isn't defined.
|
isn't defined.
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
In older versions, this field doesn't permit ``null=True``, so you have to
|
|
||||||
use :class:`NullBooleanField` instead. Using the latter is now discouraged
|
|
||||||
as it's likely to be deprecated in a future version of Django.
|
|
||||||
|
|
||||||
``CharField``
|
``CharField``
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
|
|
@ -40,10 +40,6 @@ For example ``Index(fields=['headline', '-pub_date'])`` would create SQL with
|
||||||
``(headline, pub_date DESC)``. Index ordering isn't supported on MySQL. In that
|
``(headline, pub_date DESC)``. Index ordering isn't supported on MySQL. In that
|
||||||
case, a descending index is created as a normal index.
|
case, a descending index is created as a normal index.
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
Older versions don't accept a tuple.
|
|
||||||
|
|
||||||
``name``
|
``name``
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|
|
@ -325,10 +325,6 @@ Django quotes column and table names behind the scenes.
|
||||||
before the model is created by :djadmin:`migrate` in order to prevent any
|
before the model is created by :djadmin:`migrate` in order to prevent any
|
||||||
omitted permissions from being created.
|
omitted permissions from being created.
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
The ``view`` permission was added.
|
|
||||||
|
|
||||||
``proxy``
|
``proxy``
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
|
|
@ -544,10 +544,6 @@ ordering. For example::
|
||||||
>>> Blog.objects.values('name__lower')
|
>>> Blog.objects.values('name__lower')
|
||||||
<QuerySet [{'name__lower': 'beatles blog'}]>
|
<QuerySet [{'name__lower': 'beatles blog'}]>
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
Support for lookups was added.
|
|
||||||
|
|
||||||
An aggregate within a ``values()`` clause is applied before other arguments
|
An aggregate within a ``values()`` clause is applied before other arguments
|
||||||
within the same ``values()`` clause. If you need to group by another value,
|
within the same ``values()`` clause. If you need to group by another value,
|
||||||
add it to an earlier ``values()`` clause instead. For example::
|
add it to an earlier ``values()`` clause instead. For example::
|
||||||
|
@ -752,10 +748,6 @@ Examples::
|
||||||
>>> Entry.objects.filter(headline__contains='Lennon').dates('pub_date', 'day')
|
>>> Entry.objects.filter(headline__contains='Lennon').dates('pub_date', 'day')
|
||||||
[datetime.date(2005, 3, 20)]
|
[datetime.date(2005, 3, 20)]
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
"week" support was added.
|
|
||||||
|
|
||||||
``datetimes()``
|
``datetimes()``
|
||||||
~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@ -781,10 +773,6 @@ object. If it's ``None``, Django uses the :ref:`current time zone
|
||||||
<default-current-time-zone>`. It has no effect when :setting:`USE_TZ` is
|
<default-current-time-zone>`. It has no effect when :setting:`USE_TZ` is
|
||||||
``False``.
|
``False``.
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
"week" support was added.
|
|
||||||
|
|
||||||
.. _database-time-zone-definitions:
|
.. _database-time-zone-definitions:
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
@ -2561,8 +2549,6 @@ with a copy of the ``QuerySet``’s methods. See
|
||||||
``explain()``
|
``explain()``
|
||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
.. method:: explain(format=None, **options)
|
.. method:: explain(format=None, **options)
|
||||||
|
|
||||||
Returns a string of the ``QuerySet``’s execution plan, which details how the
|
Returns a string of the ``QuerySet``’s execution plan, which details how the
|
||||||
|
|
|
@ -318,8 +318,6 @@ Methods
|
||||||
|
|
||||||
.. method:: HttpRequest.get_full_path_info()
|
.. method:: HttpRequest.get_full_path_info()
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
Like :meth:`get_full_path`, but uses :attr:`path_info` instead of
|
Like :meth:`get_full_path`, but uses :attr:`path_info` instead of
|
||||||
:attr:`path`.
|
:attr:`path`.
|
||||||
|
|
||||||
|
@ -815,10 +813,6 @@ Methods
|
||||||
isn't supported by all browsers, so it's not a replacement for Django's
|
isn't supported by all browsers, so it's not a replacement for Django's
|
||||||
CSRF protection, but rather a defense in depth measure.
|
CSRF protection, but rather a defense in depth measure.
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
The ``samesite`` argument was added.
|
|
||||||
|
|
||||||
.. _HTTPOnly: https://www.owasp.org/index.php/HTTPOnly
|
.. _HTTPOnly: https://www.owasp.org/index.php/HTTPOnly
|
||||||
.. _SameSite: https://www.owasp.org/index.php/SameSite
|
.. _SameSite: https://www.owasp.org/index.php/SameSite
|
||||||
|
|
||||||
|
@ -1107,12 +1101,6 @@ Attributes
|
||||||
headers are automatically set when they can be guessed from contents of
|
headers are automatically set when they can be guessed from contents of
|
||||||
``open_file``.
|
``open_file``.
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
The ``as_attachment`` and ``filename`` keywords argument were added.
|
|
||||||
Also, ``FileResponse`` sets the ``Content`` headers if it can guess
|
|
||||||
them.
|
|
||||||
|
|
||||||
.. _wsgi.file_wrapper: https://www.python.org/dev/peps/pep-3333/#optional-platform-specific-file-handling
|
.. _wsgi.file_wrapper: https://www.python.org/dev/peps/pep-3333/#optional-platform-specific-file-handling
|
||||||
|
|
||||||
``FileResponse`` accepts any file-like object with binary content, for example
|
``FileResponse`` accepts any file-like object with binary content, for example
|
||||||
|
@ -1128,8 +1116,6 @@ Methods
|
||||||
|
|
||||||
.. method:: FileResponse.set_headers(open_file)
|
.. method:: FileResponse.set_headers(open_file)
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
This method is automatically called during the response initialization and
|
This method is automatically called during the response initialization and
|
||||||
set various headers (``Content-Length``, ``Content-Type``, and
|
set various headers (``Content-Length``, ``Content-Type``, and
|
||||||
``Content-Disposition``) depending on ``open_file``.
|
``Content-Disposition``) depending on ``open_file``.
|
||||||
|
|
|
@ -371,8 +371,6 @@ its own CSRF cookie.
|
||||||
``CSRF_COOKIE_SAMESITE``
|
``CSRF_COOKIE_SAMESITE``
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
Default: ``'Lax'``
|
Default: ``'Lax'``
|
||||||
|
|
||||||
The value of the `SameSite`_ flag on the CSRF cookie. This flag prevents the
|
The value of the `SameSite`_ flag on the CSRF cookie. This flag prevents the
|
||||||
|
@ -3050,8 +3048,6 @@ its own session cookie.
|
||||||
``SESSION_COOKIE_SAMESITE``
|
``SESSION_COOKIE_SAMESITE``
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
Default: ``'Lax'``
|
Default: ``'Lax'``
|
||||||
|
|
||||||
The value of the `SameSite`_ flag on the session cookie. This flag prevents the
|
The value of the `SameSite`_ flag on the session cookie. This flag prevents the
|
||||||
|
|
|
@ -1793,8 +1793,6 @@ If ``value`` is the list ``['a', 'b', 'c']``, the output will be the string
|
||||||
``json_script``
|
``json_script``
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
Safely outputs a Python object as JSON, wrapped in a ``<script>`` tag, ready
|
Safely outputs a Python object as JSON, wrapped in a ``<script>`` tag, ready
|
||||||
for use with JavaScript.
|
for use with JavaScript.
|
||||||
|
|
||||||
|
|
|
@ -1128,8 +1128,6 @@ functions without the ``u``.
|
||||||
|
|
||||||
.. function:: get_supported_language_variant(lang_code, strict=False)
|
.. function:: get_supported_language_variant(lang_code, strict=False)
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
Returns ``lang_code`` if it's in the :setting:`LANGUAGES` setting, possibly
|
Returns ``lang_code`` if it's in the :setting:`LANGUAGES` setting, possibly
|
||||||
selecting a more generic variant. For example, ``'es'`` is returned if
|
selecting a more generic variant. For example, ``'es'`` is returned if
|
||||||
``lang_code`` is ``'es-ar'`` and ``'es'`` is in :setting:`LANGUAGES` but
|
``lang_code`` is ``'es-ar'`` and ``'es'`` is in :setting:`LANGUAGES` but
|
||||||
|
|
|
@ -823,12 +823,6 @@ access with an HTTP 403 Forbidden response. Anonymous users are redirected to
|
||||||
the login page or shown an HTTP 403 Forbidden response, depending on the
|
the login page or shown an HTTP 403 Forbidden response, depending on the
|
||||||
:attr:`~django.contrib.auth.mixins.AccessMixin.raise_exception` attribute.
|
:attr:`~django.contrib.auth.mixins.AccessMixin.raise_exception` attribute.
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
In older versions, authenticated users who lacked permissions were
|
|
||||||
redirected to the login page (which resulted in a loop) instead of
|
|
||||||
receiving an HTTP 403 Forbidden response.
|
|
||||||
|
|
||||||
.. class:: AccessMixin
|
.. class:: AccessMixin
|
||||||
|
|
||||||
.. attribute:: login_url
|
.. attribute:: login_url
|
||||||
|
|
|
@ -412,14 +412,6 @@ from the ``User`` model.
|
||||||
Returns ``False`` if the password is a result of
|
Returns ``False`` if the password is a result of
|
||||||
:meth:`.User.set_unusable_password`.
|
:meth:`.User.set_unusable_password`.
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
In older versions, this also returns ``False`` if the password is
|
|
||||||
``None`` or an empty string, or if the password uses a hasher that's
|
|
||||||
not in the :setting:`PASSWORD_HASHERS` setting. That behavior is
|
|
||||||
considered a bug as it prevents users with such passwords from
|
|
||||||
requesting a password reset.
|
|
||||||
|
|
||||||
.. _password-validation:
|
.. _password-validation:
|
||||||
|
|
||||||
Password validation
|
Password validation
|
||||||
|
@ -538,10 +530,6 @@ Django includes four validators:
|
||||||
common passwords. This file should contain one lowercase password per line
|
common passwords. This file should contain one lowercase password per line
|
||||||
and may be plain text or gzipped.
|
and may be plain text or gzipped.
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
In older versions, a list of 1,000 common passwords is used.
|
|
||||||
|
|
||||||
.. class:: NumericPasswordValidator()
|
.. class:: NumericPasswordValidator()
|
||||||
|
|
||||||
Validates whether the password is not entirely numeric.
|
Validates whether the password is not entirely numeric.
|
||||||
|
|
|
@ -329,10 +329,6 @@ cross-process caching is possible. This obviously also means the local memory
|
||||||
cache isn't particularly memory-efficient, so it's probably not a good choice
|
cache isn't particularly memory-efficient, so it's probably not a good choice
|
||||||
for production environments. It's nice for development.
|
for production environments. It's nice for development.
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
Older versions use a pseudo-random culling strategy rather than LRU.
|
|
||||||
|
|
||||||
Dummy caching (for development)
|
Dummy caching (for development)
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
|
@ -907,8 +903,6 @@ from the cache, not just the keys set by your application. ::
|
||||||
|
|
||||||
.. method:: cache.touch(key, timeout=DEFAULT_TIMEOUT, version=None)
|
.. method:: cache.touch(key, timeout=DEFAULT_TIMEOUT, version=None)
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
``cache.touch()`` sets a new expiration for a key. For example, to update a key
|
``cache.touch()`` sets a new expiration for a key. For example, to update a key
|
||||||
to expire 10 seconds from now::
|
to expire 10 seconds from now::
|
||||||
|
|
||||||
|
|
|
@ -1778,10 +1778,6 @@ language choice in the user's session. It also saves the language choice in a
|
||||||
cookie that is named ``django_language`` by default. (The name can be changed
|
cookie that is named ``django_language`` by default. (The name can be changed
|
||||||
through the :setting:`LANGUAGE_COOKIE_NAME` setting.)
|
through the :setting:`LANGUAGE_COOKIE_NAME` setting.)
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
In older versions, the cookie is only set if session support isn't enabled.
|
|
||||||
|
|
||||||
After setting the language choice, Django looks for a ``next`` parameter in the
|
After setting the language choice, Django looks for a ``next`` parameter in the
|
||||||
``POST`` or ``GET`` data. If that is found and Django considers it to be a safe
|
``POST`` or ``GET`` data. If that is found and Django considers it to be a safe
|
||||||
URL (i.e. it doesn't point to a different host and uses a safe scheme), a
|
URL (i.e. it doesn't point to a different host and uses a safe scheme), a
|
||||||
|
@ -2098,10 +2094,6 @@ etc. Untranslated strings for territorial language variants use the translations
|
||||||
of the generic language. For example, untranslated ``pt_BR`` strings use ``pt``
|
of the generic language. For example, untranslated ``pt_BR`` strings use ``pt``
|
||||||
translations.
|
translations.
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
Fallback to the generic language as described above was added.
|
|
||||||
|
|
||||||
This way, you can write applications that include their own translations, and
|
This way, you can write applications that include their own translations, and
|
||||||
you can override base translations in your project. Or, you can just build
|
you can override base translations in your project. Or, you can just build
|
||||||
a big project out of several apps and put all translations into one big common
|
a big project out of several apps and put all translations into one big common
|
||||||
|
|
|
@ -683,10 +683,6 @@ Django can serialize the following:
|
||||||
- Any class reference (must be in module's top-level scope)
|
- Any class reference (must be in module's top-level scope)
|
||||||
- Anything with a custom ``deconstruct()`` method (:ref:`see below <custom-deconstruct-method>`)
|
- Anything with a custom ``deconstruct()`` method (:ref:`see below <custom-deconstruct-method>`)
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
Serialization support for :class:`functools.partialmethod` was added.
|
|
||||||
|
|
||||||
.. versionchanged:: 2.2
|
.. versionchanged:: 2.2
|
||||||
|
|
||||||
Serialization support for ``NoneType`` was added.
|
Serialization support for ``NoneType`` was added.
|
||||||
|
|
|
@ -128,10 +128,6 @@ Use the ``django.test.Client`` class to make requests.
|
||||||
The ``json_encoder`` argument allows setting a custom JSON encoder for
|
The ``json_encoder`` argument allows setting a custom JSON encoder for
|
||||||
the JSON serialization that's described in :meth:`post`.
|
the JSON serialization that's described in :meth:`post`.
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
The ``json_encoder`` argument was added.
|
|
||||||
|
|
||||||
Once you have a ``Client`` instance, you can call any of the following
|
Once you have a ``Client`` instance, you can call any of the following
|
||||||
methods:
|
methods:
|
||||||
|
|
||||||
|
@ -221,12 +217,6 @@ Use the ``django.test.Client`` class to make requests.
|
||||||
:class:`Client`. This serialization also happens for :meth:`put`,
|
:class:`Client`. This serialization also happens for :meth:`put`,
|
||||||
:meth:`patch`, and :meth:`delete` requests.
|
:meth:`patch`, and :meth:`delete` requests.
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
The JSON serialization described above was added. In older versions,
|
|
||||||
you can call :func:`json.dumps` on ``data`` before passing it to
|
|
||||||
``post()`` to achieve the same thing.
|
|
||||||
|
|
||||||
.. versionchanged:: 2.2
|
.. versionchanged:: 2.2
|
||||||
|
|
||||||
The JSON serialization was extended to support lists and tuples. In
|
The JSON serialization was extended to support lists and tuples. In
|
||||||
|
@ -1449,8 +1439,6 @@ your test suite.
|
||||||
.. method:: SimpleTestCase.assertWarnsMessage(expected_warning, expected_message, callable, *args, **kwargs)
|
.. method:: SimpleTestCase.assertWarnsMessage(expected_warning, expected_message, callable, *args, **kwargs)
|
||||||
SimpleTestCase.assertWarnsMessage(expected_warning, expected_message)
|
SimpleTestCase.assertWarnsMessage(expected_warning, expected_message)
|
||||||
|
|
||||||
.. versionadded:: 2.1
|
|
||||||
|
|
||||||
Analogous to :meth:`SimpleTestCase.assertRaisesMessage` but for
|
Analogous to :meth:`SimpleTestCase.assertRaisesMessage` but for
|
||||||
:meth:`~unittest.TestCase.assertWarnsRegex` instead of
|
:meth:`~unittest.TestCase.assertWarnsRegex` instead of
|
||||||
:meth:`~unittest.TestCase.assertRaisesRegex`.
|
:meth:`~unittest.TestCase.assertRaisesRegex`.
|
||||||
|
@ -1755,12 +1743,6 @@ class. Given::
|
||||||
``SampleTestCaseChild.test`` will be labeled with ``'slow'``, ``'core'``,
|
``SampleTestCaseChild.test`` will be labeled with ``'slow'``, ``'core'``,
|
||||||
``'bar'``, and ``'foo'``.
|
``'bar'``, and ``'foo'``.
|
||||||
|
|
||||||
.. versionchanged:: 2.1
|
|
||||||
|
|
||||||
In older versions, tagged tests don't inherit tags from classes, and
|
|
||||||
tagged subclasses don't inherit tags from superclasses. For example,
|
|
||||||
``SampleTestCaseChild.test`` is labeled only with ``'bar'``.
|
|
||||||
|
|
||||||
Then you can choose which tests to run. For example, to run only fast tests:
|
Then you can choose which tests to run. For example, to run only fast tests:
|
||||||
|
|
||||||
.. console::
|
.. console::
|
||||||
|
|
Loading…
Reference in New Issue