2015-01-17 07:00:45 +08:00
|
|
|
============================================
|
|
|
|
Django 1.9 release notes - UNDER DEVELOPMENT
|
|
|
|
============================================
|
|
|
|
|
|
|
|
Welcome to Django 1.9!
|
|
|
|
|
|
|
|
These release notes cover the `new features`_, as well as some `backwards
|
|
|
|
incompatible changes`_ you'll want to be aware of when upgrading from Django
|
|
|
|
1.8 or older versions. We've :ref:`dropped some features
|
|
|
|
<deprecation-removed-in-1.9>` that have reached the end of their deprecation
|
|
|
|
cycle, and we've `begun the deprecation process for some features`_.
|
|
|
|
|
|
|
|
.. _`new features`: `What's new in Django 1.9`_
|
|
|
|
.. _`backwards incompatible changes`: `Backwards incompatible changes in 1.9`_
|
|
|
|
.. _`dropped some features`: `Features removed in 1.9`_
|
|
|
|
.. _`begun the deprecation process for some features`: `Features deprecated in 1.9`_
|
|
|
|
|
|
|
|
Python compatibility
|
|
|
|
====================
|
|
|
|
|
|
|
|
Like Django 1.8, Django 1.9 requires Python 2.7 or above, though we
|
|
|
|
**highly recommend** the latest minor release. We've dropped support for
|
|
|
|
Python 3.2 and added support for Python 3.5.
|
|
|
|
|
|
|
|
What's new in Django 1.9
|
|
|
|
========================
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
Minor features
|
|
|
|
~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
:mod:`django.contrib.admin`
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2014-12-27 15:16:53 +08:00
|
|
|
* Admin views now have ``model_admin`` or ``admin_site`` attributes.
|
2015-01-17 07:00:45 +08:00
|
|
|
|
2015-02-08 00:55:47 +08:00
|
|
|
* The URL of the admin change view has been changed (was at
|
|
|
|
``/admin/<app>/<model>/<pk>/`` by default and is now at
|
|
|
|
``/admin/<app>/<model>/<pk>/change/``). This should not affect your
|
|
|
|
application unless you have hardcoded admin URLs. In that case, replace those
|
|
|
|
links by :ref:`reversing admin URLs <admin-reverse-urls>` instead. Note that
|
|
|
|
the old URL still redirects to the new one for backwards compatibility, but
|
|
|
|
it may be removed in a future version.
|
|
|
|
|
2015-03-16 18:00:16 +08:00
|
|
|
* :meth:`ModelAdmin.get_list_select_related()
|
|
|
|
<django.contrib.admin.ModelAdmin.get_list_select_related>` was added to allow
|
|
|
|
changing the ``select_related()`` values used in the admin's changelist query
|
|
|
|
based on the request.
|
|
|
|
|
2015-01-17 07:00:45 +08:00
|
|
|
:mod:`django.contrib.auth`
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2015-01-17 08:27:10 +08:00
|
|
|
* The default iteration count for the PBKDF2 password hasher has been increased
|
|
|
|
by 20%. This backwards compatible change will not affect users who have
|
|
|
|
subclassed ``django.contrib.auth.hashers.PBKDF2PasswordHasher`` to change the
|
|
|
|
default value.
|
2015-01-17 07:00:45 +08:00
|
|
|
|
2015-02-27 03:04:24 +08:00
|
|
|
* The ``BCryptSHA256PasswordHasher`` will now update passwords if its
|
|
|
|
``rounds`` attribute is changed.
|
|
|
|
|
2015-01-17 07:00:45 +08:00
|
|
|
:mod:`django.contrib.gis`
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2015-01-31 03:23:23 +08:00
|
|
|
* All ``GeoQuerySet`` methods have been deprecated and replaced by
|
|
|
|
:doc:`equivalent database functions </ref/contrib/gis/functions>`. As soon
|
|
|
|
as the legacy methods have been replaced in your code, you should even be
|
|
|
|
able to remove the special ``GeoManager`` from your GIS-enabled classes.
|
|
|
|
|
2015-03-14 02:49:02 +08:00
|
|
|
* The GDAL interface now supports instantiating file-based and in-memory
|
|
|
|
:ref:`GDALRaster objects <raster-data-source-objects>` from raw data.
|
|
|
|
Setters for raster properties such as projection or pixel values have
|
|
|
|
been added.
|
2015-01-17 07:00:45 +08:00
|
|
|
|
|
|
|
:mod:`django.contrib.messages`
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
2015-02-08 23:21:48 +08:00
|
|
|
:mod:`django.contrib.postgres`
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
* Added :doc:`/ref/contrib/postgres/aggregates`.
|
|
|
|
|
2015-01-17 07:00:45 +08:00
|
|
|
:mod:`django.contrib.redirects`
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
:mod:`django.contrib.sessions`
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
:mod:`django.contrib.sitemaps`
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
:mod:`django.contrib.sites`
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
:mod:`django.contrib.staticfiles`
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
:mod:`django.contrib.syndication`
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
Cache
|
|
|
|
^^^^^
|
|
|
|
|
2014-11-24 02:33:07 +08:00
|
|
|
* ``django.core.cache.backends.base.BaseCache`` now has a ``get_or_set()``
|
|
|
|
method.
|
2015-01-17 07:00:45 +08:00
|
|
|
|
|
|
|
Email
|
|
|
|
^^^^^
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
File Storage
|
|
|
|
^^^^^^^^^^^^
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
File Uploads
|
|
|
|
^^^^^^^^^^^^
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
Forms
|
|
|
|
^^^^^
|
|
|
|
|
2015-02-07 05:19:23 +08:00
|
|
|
* :class:`~django.forms.ModelForm` accepts the new ``Meta`` option
|
|
|
|
``field_classes`` to customize the type of the fields. See
|
|
|
|
:ref:`modelforms-overriding-default-fields` for details.
|
2015-01-17 07:00:45 +08:00
|
|
|
|
2015-03-16 08:33:59 +08:00
|
|
|
* You can now specify the order in which form fields are rendered with the
|
|
|
|
:attr:`~django.forms.Form.field_order` attribute, the ``field_order``
|
|
|
|
constructor argument , or the :meth:`~django.forms.Form.order_fields` method.
|
|
|
|
|
2014-12-27 15:16:53 +08:00
|
|
|
Generic Views
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
* Class based views generated using ``as_view()`` now have ``view_class``
|
|
|
|
and ``view_initkwargs`` attributes.
|
|
|
|
|
2015-01-17 07:00:45 +08:00
|
|
|
Internationalization
|
|
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2015-03-12 16:32:29 +08:00
|
|
|
* The :func:`django.views.i18n.set_language` view now properly redirects to
|
|
|
|
:ref:`translated URLs <url-internationalization>`, when available.
|
2015-01-17 07:00:45 +08:00
|
|
|
|
2014-02-23 22:10:31 +08:00
|
|
|
* The :func:`django.views.i18n.javascript_catalog` view now works correctly
|
|
|
|
if used multiple times with different configurations on the same page.
|
|
|
|
|
2015-03-31 13:58:37 +08:00
|
|
|
* The :func:`django.utils.timezone.make_aware` function gained an ``is_dst``
|
|
|
|
argument to help resolve ambiguous times during DST transitions.
|
|
|
|
|
2015-01-17 07:00:45 +08:00
|
|
|
Management Commands
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2015-03-07 20:55:59 +08:00
|
|
|
* The new :djadmin:`sendtestemail` command lets you send a test email to
|
|
|
|
easily confirm that email sending through Django is working.
|
2015-01-17 07:00:45 +08:00
|
|
|
|
2015-03-29 22:59:35 +08:00
|
|
|
* To increase the readability of the SQL code generated by
|
|
|
|
:djadmin:`sqlmigrate`, the SQL code generated for each migration operation is
|
|
|
|
preceded by the operation's description.
|
|
|
|
|
2015-04-02 03:42:09 +08:00
|
|
|
* The :djadmin:`dumpdata` command output is now deterministically ordered.
|
|
|
|
|
2015-04-02 05:33:27 +08:00
|
|
|
* The :djadmin:`createcachetable` command now has a ``--dry-run`` flag to
|
|
|
|
print out the SQL rather than execute it.
|
|
|
|
|
2015-01-17 07:00:45 +08:00
|
|
|
Models
|
|
|
|
^^^^^^
|
|
|
|
|
2015-01-30 02:15:27 +08:00
|
|
|
* Added the :meth:`RelatedManager.set()
|
|
|
|
<django.db.models.fields.related.RelatedManager.set()>` method to the related
|
|
|
|
managers created by ``ForeignKey``, ``GenericForeignKey``, and
|
|
|
|
``ManyToManyField``.
|
2015-01-17 07:00:45 +08:00
|
|
|
|
2015-02-07 07:16:26 +08:00
|
|
|
* Added the ``keep_parents`` parameter to :meth:`Model.delete()
|
|
|
|
<django.db.models.Model.delete>` to allow deleting only a child's data in a
|
|
|
|
model that uses multi-table inheritance.
|
|
|
|
|
2015-03-17 22:42:53 +08:00
|
|
|
* Added a system check to prevent defining both ``Meta.ordering`` and
|
|
|
|
``order_with_respect_to`` on the same model.
|
|
|
|
|
2015-03-23 04:30:57 +08:00
|
|
|
* :lookup:`Date and time <year>` lookups can be chained with other lookups
|
|
|
|
(such as :lookup:`exact`, :lookup:`gt`, :lookup:`lt`, etc.). For example:
|
|
|
|
``Entry.objects.filter(pub_date__month__gt=6)``.
|
|
|
|
|
2015-02-22 05:57:02 +08:00
|
|
|
CSRF
|
|
|
|
^^^^
|
|
|
|
|
|
|
|
* The request header's name used for CSRF authentication can be customized
|
|
|
|
with :setting:`CSRF_HEADER_NAME`.
|
|
|
|
|
2015-01-17 07:00:45 +08:00
|
|
|
Signals
|
|
|
|
^^^^^^^
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
|
|
|
Templates
|
|
|
|
^^^^^^^^^
|
|
|
|
|
2015-01-17 07:34:32 +08:00
|
|
|
* Template tags created with the :meth:`~django.template.Library.simple_tag`
|
|
|
|
helper can now store results in a template variable by using the ``as``
|
|
|
|
argument.
|
2015-01-17 07:00:45 +08:00
|
|
|
|
2015-03-12 00:00:17 +08:00
|
|
|
* Added a :meth:`Context.setdefault() <django.template.Context.setdefault>`
|
|
|
|
method.
|
|
|
|
|
2014-04-15 05:18:03 +08:00
|
|
|
* A warning will now be logged for missing context variables. These messages
|
|
|
|
will be logged to the :ref:`django.template <django-template-logger>` logger.
|
|
|
|
|
2015-04-13 23:27:30 +08:00
|
|
|
* The :ttag:`firstof` template tag supports storing the output in a variable
|
|
|
|
using 'as'.
|
|
|
|
|
2015-04-13 22:57:44 +08:00
|
|
|
* :meth:`Context.update() <django.template.Context.update>` can now be used as
|
|
|
|
a context manager.
|
|
|
|
|
2015-03-23 08:22:38 +08:00
|
|
|
* Django template loaders can now extend templates recursively.
|
|
|
|
|
|
|
|
* The debug page template postmortem now include output from each engine that
|
|
|
|
is installed.
|
|
|
|
|
2015-01-17 07:00:45 +08:00
|
|
|
Requests and Responses
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2015-01-13 06:45:09 +08:00
|
|
|
* Unless :attr:`HttpResponse.reason_phrase
|
|
|
|
<django.http.HttpResponse.reason_phrase>` is explicitly set, it now is
|
|
|
|
determined by the current value of :attr:`HttpResponse.status_code
|
|
|
|
<django.http.HttpResponse.status_code>`. Modifying the value of
|
|
|
|
``status_code`` outside of the constructor will also modify the value of
|
|
|
|
``reason_phrase``.
|
2015-01-17 07:00:45 +08:00
|
|
|
|
2014-11-15 23:03:20 +08:00
|
|
|
* The debug view now shows details of chained exceptions on Python 3.
|
|
|
|
|
2015-01-17 07:00:45 +08:00
|
|
|
Tests
|
|
|
|
^^^^^
|
|
|
|
|
|
|
|
* ...
|
|
|
|
|
2015-03-21 20:19:13 +08:00
|
|
|
URLs
|
|
|
|
^^^^
|
|
|
|
|
|
|
|
* Regular expression lookaround assertions are now allowed in URL patterns.
|
|
|
|
|
2015-01-17 07:00:45 +08:00
|
|
|
Validators
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
2015-02-14 22:20:43 +08:00
|
|
|
* Added :func:`django.core.validators.int_list_validator` to generate
|
|
|
|
validators of strings containing integers separated with a custom character.
|
2015-01-17 07:00:45 +08:00
|
|
|
|
2015-04-15 02:42:49 +08:00
|
|
|
* :class:`~django.core.validators.EmailValidator` now limits the length of
|
|
|
|
domain name labels to 63 characters per :rfc:`1034`.
|
|
|
|
|
2015-01-17 07:00:45 +08:00
|
|
|
Backwards incompatible changes in 1.9
|
|
|
|
=====================================
|
|
|
|
|
|
|
|
.. warning::
|
|
|
|
|
|
|
|
In addition to the changes outlined in this section, be sure to review the
|
|
|
|
:doc:`deprecation timeline </internals/deprecation>` for any features that
|
|
|
|
have been removed. If you haven't updated your code within the
|
|
|
|
deprecation timeline for a given feature, its removal may appear as a
|
|
|
|
backwards incompatible change.
|
|
|
|
|
2014-12-30 00:41:16 +08:00
|
|
|
Database backend API
|
|
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
* A couple of new tests rely on the ability of the backend to introspect column
|
|
|
|
defaults (returning the result as ``Field.default``). You can set the
|
|
|
|
``can_introspect_default`` database feature to ``False`` if your backend
|
|
|
|
doesn't implement this. You may want to review the implementation on the
|
|
|
|
backends that Django includes for reference (:ticket:`24245`).
|
|
|
|
|
2015-01-22 00:55:57 +08:00
|
|
|
Default settings that were tuples are now lists
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
The default settings in ``django.conf.global_settings`` were a combination of
|
|
|
|
lists and tuples. All settings that were formerly tuples are now lists.
|
|
|
|
|
2015-02-04 05:35:55 +08:00
|
|
|
``is_usable`` attribute on template loaders is removed
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Django template loaders previously required an ``is_usable`` attribute to be
|
|
|
|
defined. If a loader was configured in the template settings and this attribute
|
|
|
|
was ``False``, the loader would be silently ignored. In practice, this was only
|
|
|
|
used by the egg loader to detect if setuptools was installed. The ``is_usable``
|
|
|
|
attribute is now removed and the egg loader instead fails at runtime if
|
|
|
|
setuptools is not installed.
|
|
|
|
|
2015-01-30 02:15:27 +08:00
|
|
|
Related set direct assignment
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
:ref:`Direct assignment <direct-assignment>`) used to perform a ``clear()``
|
|
|
|
followed by a call to ``add()``. This caused needlessly large data changes
|
|
|
|
and prevented using the :data:`~django.db.models.signals.m2m_changed` signal
|
|
|
|
to track individual changes in many-to-many relations.
|
|
|
|
|
|
|
|
Direct assignment now relies on the the new
|
|
|
|
:meth:`django.db.models.fields.related.RelatedManager.set()` method on
|
|
|
|
related managers which by default only processes changes between the
|
|
|
|
existing related set and the one that's newly assigned. The previous behavior
|
|
|
|
can be restored by replacing direct assignment by a call to ``set()`` with
|
|
|
|
the keyword argument ``clear=True``.
|
|
|
|
|
|
|
|
``ModelForm``, and therefore ``ModelAdmin``, internally rely on direct
|
|
|
|
assignment for many-to-many relations and as a consequence now use the new
|
|
|
|
behavior.
|
|
|
|
|
2015-03-03 03:31:14 +08:00
|
|
|
Filesystem-based template loaders catch more specific exceptions
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
When using the :class:`filesystem.Loader <django.template.loaders.filesystem.Loader>`
|
|
|
|
or :class:`app_directories.Loader <django.template.loaders.app_directories.Loader>`
|
|
|
|
template loaders, earlier versions of Django raised a
|
|
|
|
:exc:`~django.template.TemplateDoesNotExist` error if a template source existed
|
|
|
|
but was unreadable. This could happen under many circumstances, such as if
|
|
|
|
Django didn't have permissions to open the file, or if the template source was
|
|
|
|
a directory. Now, Django only silences the exception if the template source
|
|
|
|
does not exist. All other situations result in the original ``IOError`` being
|
|
|
|
raised.
|
|
|
|
|
2015-03-14 06:40:14 +08:00
|
|
|
HTTP redirects no longer forced to absolute URIs
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Relative redirects are no longer converted to absolute URIs. :rfc:`2616`
|
|
|
|
required the ``Location`` header in redirect responses to be an absolute URI,
|
|
|
|
but it has been superseded by :rfc:`7231` which allows relative URIs in
|
|
|
|
``Location``, recognizing the actual practice of user agents, almost all of
|
|
|
|
which support them.
|
|
|
|
|
|
|
|
Consequently, the expected URLs passed to ``assertRedirects`` should generally
|
|
|
|
no longer include the scheme and domain part of the URLs. For example,
|
|
|
|
``self.assertRedirects(response, 'http://testserver/some-url/')`` should be
|
|
|
|
replaced by ``self.assertRedirects(response, '/some-url/')`` (unless the
|
|
|
|
redirection specifically contained an absolute URL, of course).
|
|
|
|
|
2015-03-27 19:53:45 +08:00
|
|
|
Dropped support for PostgreSQL 9.0
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Upstream support for PostgreSQL 9.0 ended in September 2015. As a consequence,
|
|
|
|
Django 1.9 sets 9.1 as the minimum PostgreSQL version it officially supports.
|
|
|
|
|
2015-03-23 08:22:38 +08:00
|
|
|
Template ``LoaderOrigin`` and ``StringOrigin`` are removed
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
In previous versions of Django, when a template engine was initialized with
|
|
|
|
debug as ``True``, an instance of ``django.template.loader.LoaderOrigin`` or
|
|
|
|
``django.template.base.StringOrigin`` was set as the origin attribute on the
|
|
|
|
template object. These classes have been combined into
|
|
|
|
:class:`~django.template.base.Origin` and is now always set regardless of the
|
|
|
|
engine debug setting.
|
|
|
|
|
2015-03-24 06:17:43 +08:00
|
|
|
.. _default-logging-changes-19:
|
|
|
|
|
|
|
|
Changes to the default logging configuration
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
To make it easier to write custom logging configurations, Django's default
|
|
|
|
logging configuration no longer defines 'django.request' and 'django.security'
|
|
|
|
loggers. Instead, it defines a single 'django' logger with two handlers:
|
|
|
|
|
|
|
|
* 'console': filtered at the ``INFO`` level and only active if ``DEBUG=True``.
|
|
|
|
* 'mail_admins': filtered at the ``ERROR`` level and only active if
|
|
|
|
``DEBUG=False``.
|
|
|
|
|
|
|
|
If you aren't overriding Django's default logging, you should see minimal
|
|
|
|
changes in behavior, but you might see some new logging to the ``runserver``
|
|
|
|
console, for example.
|
|
|
|
|
|
|
|
If you are overriding Django's default logging, you should check to see how
|
|
|
|
your configuration merges with the new defaults.
|
|
|
|
|
2015-01-17 07:00:45 +08:00
|
|
|
Miscellaneous
|
|
|
|
~~~~~~~~~~~~~
|
|
|
|
|
2015-01-27 12:02:53 +08:00
|
|
|
* CSS and images in ``contrib.admin`` to support Internet Explorer 6 & 7 have
|
|
|
|
been removed as these browsers have reached end-of-life.
|
2015-01-17 07:00:45 +08:00
|
|
|
|
2015-03-12 21:40:03 +08:00
|
|
|
* The text displayed for null columns in the admin changelist ``list_display``
|
|
|
|
cells has changed from ``(None)`` (or its translated equivalent) to ``-``.
|
|
|
|
|
2015-01-14 03:29:07 +08:00
|
|
|
* ``django.http.responses.REASON_PHRASES`` and
|
|
|
|
``django.core.handlers.wsgi.STATUS_CODE_TEXT`` have been removed. Use
|
|
|
|
Python's stdlib instead: :data:`http.client.responses` for Python 3 and
|
|
|
|
`httplib.responses`_ for Python 2.
|
|
|
|
|
|
|
|
.. _`httplib.responses`: https://docs.python.org/2/library/httplib.html#httplib.responses
|
|
|
|
|
2015-01-30 15:26:13 +08:00
|
|
|
* ``ValuesQuerySet`` and ``ValuesListQuerySet`` have been removed.
|
|
|
|
|
2015-03-05 02:05:17 +08:00
|
|
|
* The ``admin/base.html`` template no longer sets
|
|
|
|
``window.__admin_media_prefix__``. Image references in JavaScript that used
|
|
|
|
that value to construct absolute URLs have been moved to CSS for easier
|
|
|
|
customization.
|
|
|
|
|
2015-02-14 22:20:43 +08:00
|
|
|
* ``CommaSeparatedIntegerField`` validation has been refined to forbid values
|
|
|
|
like ``','``, ``',1'``, and ``'1,,2'``.
|
|
|
|
|
2015-04-15 04:50:36 +08:00
|
|
|
* Form initialization was moved from the :meth:`ProcessFormView.get()
|
|
|
|
<django.views.generic.edit.ProcessFormView.get>` method to the new
|
|
|
|
:meth:`FormMixin.get_context_data()
|
|
|
|
<django.views.generic.edit.FormMixin.get_context_data>` method. This may be
|
|
|
|
backwards incompatible if you have overridden the ``get_context_data()``
|
|
|
|
method without calling ``super()``.
|
|
|
|
|
2015-01-17 07:00:45 +08:00
|
|
|
.. _deprecated-features-1.9:
|
|
|
|
|
|
|
|
Features deprecated in 1.9
|
|
|
|
==========================
|
|
|
|
|
2015-01-17 07:34:32 +08:00
|
|
|
``assignment_tag()``
|
|
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Django 1.4 added the ``assignment_tag`` helper to ease the creation of
|
|
|
|
template tags that store results in a template variable. The
|
|
|
|
:meth:`~django.template.Library.simple_tag` helper has gained this same
|
|
|
|
ability, making the ``assignment_tag`` obsolete. Tags that use
|
|
|
|
``assignment_tag`` should be updated to use ``simple_tag``.
|
|
|
|
|
2015-03-06 01:38:42 +08:00
|
|
|
``{% cycle %}`` syntax with comma-separated arguments
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
The :ttag:`cycle` tag supports an inferior old syntax from previous Django
|
|
|
|
versions:
|
|
|
|
|
|
|
|
.. code-block:: html+django
|
|
|
|
|
|
|
|
{% cycle row1,row2,row3 %}
|
|
|
|
|
|
|
|
Its parsing caused bugs with the current syntax, so support for the old syntax
|
|
|
|
will be removed in Django 2.0 following an accelerated deprecation.
|
|
|
|
|
2015-02-26 22:19:17 +08:00
|
|
|
``Field.rel`` changes
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
``Field.rel`` and its methods and attributes have changed to match the related
|
|
|
|
fields API. The ``Field.rel`` attribute is renamed to ``remote_field`` and many
|
|
|
|
of its methods and attributes are either changed or renamed.
|
|
|
|
|
|
|
|
The aim of these changes is to provide a documented API for relation fields.
|
|
|
|
|
2015-01-30 03:12:08 +08:00
|
|
|
``GeoManager`` and ``GeoQuerySet`` custom methods
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
All custom ``GeoQuerySet`` methods (``area()``, ``distance()``, ``gml()``, ...)
|
|
|
|
have been replaced by equivalent geographic expressions in annotations (see in
|
|
|
|
new features). Hence the need to set a custom ``GeoManager`` to GIS-enabled
|
|
|
|
models is now obsolete. As soon as your code doesn't call any of the deprecated
|
|
|
|
methods, you can simply remove the ``objects = GeoManager()`` lines from your
|
|
|
|
models.
|
|
|
|
|
2015-03-23 08:22:38 +08:00
|
|
|
Template loader APIs have changed
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Django template loaders have been updated to allow recursive template
|
|
|
|
extending. This change necessitated a new template loader API. The old
|
|
|
|
``load_template()`` and ``load_template_sources()`` methods are now deprecated.
|
|
|
|
Details about the new API can be found :ref:`in the template loader
|
|
|
|
documentation <custom-template-loaders>`.
|
|
|
|
|
2015-01-22 02:26:51 +08:00
|
|
|
Miscellaneous
|
|
|
|
~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
* The ``weak`` argument to ``django.dispatch.signals.Signal.disconnect()`` has
|
|
|
|
been deprecated as it has no effect.
|
2015-01-17 07:00:45 +08:00
|
|
|
|
2015-01-27 12:29:06 +08:00
|
|
|
* The ``check_aggregate_support()`` method of
|
|
|
|
``django.db.backends.base.BaseDatabaseOperations`` has been deprecated and
|
|
|
|
will be removed in Django 2.1. The more general ``check_expression_support()``
|
|
|
|
should be used instead.
|
|
|
|
|
2015-01-28 02:50:00 +08:00
|
|
|
* ``django.forms.extras`` is deprecated. You can find
|
2015-01-26 11:28:57 +08:00
|
|
|
:class:`~django.forms.SelectDateWidget` in ``django.forms.widgets``
|
|
|
|
(or simply ``django.forms``) instead.
|
|
|
|
|
2015-03-03 16:43:56 +08:00
|
|
|
* Private API ``django.db.models.fields.add_lazy_relation()`` is deprecated.
|
|
|
|
|
2015-04-07 03:02:34 +08:00
|
|
|
* The ``django.contrib.auth.tests.utils.skipIfCustomUser()`` decorator is
|
|
|
|
deprecated. With the test discovery changes in Django 1.6, the tests for
|
|
|
|
``django.contrib`` apps are no longer run as part of the user's project.
|
|
|
|
Therefore, the ``@skipIfCustomUser`` decorator is no longer needed to
|
|
|
|
decorate tests in ``django.contrib.auth``.
|
|
|
|
|
2015-01-17 07:00:45 +08:00
|
|
|
.. removed-features-1.9:
|
|
|
|
|
|
|
|
Features removed in 1.9
|
|
|
|
=======================
|
|
|
|
|
|
|
|
These features have reached the end of their deprecation cycle and so have been
|
|
|
|
removed in Django 1.9 (please see the :ref:`deprecation timeline
|
|
|
|
<deprecation-removed-in-1.9>` for more details):
|
|
|
|
|
|
|
|
* ``django.utils.dictconfig`` is removed.
|
|
|
|
|
|
|
|
* ``django.utils.importlib`` is removed.
|
|
|
|
|
|
|
|
* ``django.utils.tzinfo`` is removed.
|
|
|
|
|
|
|
|
* ``django.utils.unittest`` is removed.
|
|
|
|
|
|
|
|
* The ``syncdb`` command is removed.
|
|
|
|
|
|
|
|
* ``django.db.models.signals.pre_syncdb`` and
|
|
|
|
``django.db.models.signals.post_syncdb`` is removed.
|
|
|
|
|
|
|
|
* Support for ``allow_syncdb`` on database routers is removed.
|
|
|
|
|
|
|
|
* The legacy method of syncing apps without migrations is removed,
|
|
|
|
and migrations are compulsory for all apps. This includes automatic
|
|
|
|
loading of ``initial_data`` fixtures and support for initial SQL data.
|
|
|
|
|
|
|
|
* All models need to be defined inside an installed application or declare an
|
|
|
|
explicit :attr:`~django.db.models.Options.app_label`. Furthermore, it isn't
|
|
|
|
possible to import them before their application is loaded. In particular, it
|
|
|
|
isn't possible to import models inside the root package of an application.
|
|
|
|
|
|
|
|
* The model and form ``IPAddressField`` is removed. A stub field remains for
|
|
|
|
compatibility with historical migrations.
|
|
|
|
|
|
|
|
* ``AppCommand.handle_app()`` is no longer be supported.
|
|
|
|
|
2015-01-19 10:57:38 +08:00
|
|
|
* ``RequestSite`` and ``get_current_site()`` are no longer importable from
|
|
|
|
``django.contrib.sites.models``.
|
2015-01-17 07:00:45 +08:00
|
|
|
|
|
|
|
* FastCGI support via the ``runfcgi`` management command is removed.
|
|
|
|
|
|
|
|
* ``django.utils.datastructures.SortedDict`` is removed.
|
|
|
|
|
|
|
|
* ``ModelAdmin.declared_fieldsets`` is removed.
|
|
|
|
|
2015-01-19 10:57:38 +08:00
|
|
|
* The ``util`` modules that provided backwards compatibility are removed:
|
2015-01-17 07:00:45 +08:00
|
|
|
|
|
|
|
* ``django.contrib.admin.util``
|
|
|
|
* ``django.contrib.gis.db.backends.util``
|
|
|
|
* ``django.db.backends.util``
|
|
|
|
* ``django.forms.util``
|
|
|
|
|
|
|
|
* ``ModelAdmin.get_formsets`` is removed.
|
|
|
|
|
|
|
|
* The backward compatible shims introduced to rename the
|
|
|
|
``BaseMemcachedCache._get_memcache_timeout()`` method to
|
|
|
|
``get_backend_timeout()`` is removed.
|
|
|
|
|
|
|
|
* The ``--natural`` and ``-n`` options for :djadmin:`dumpdata` are removed.
|
|
|
|
|
|
|
|
* The ``use_natural_keys`` argument for ``serializers.serialize()`` is removed.
|
|
|
|
|
2015-01-19 10:57:38 +08:00
|
|
|
* Private API ``django.forms.forms.get_declared_fields()`` is removed.
|
2015-01-17 07:00:45 +08:00
|
|
|
|
|
|
|
* The ability to use a ``SplitDateTimeWidget`` with ``DateTimeField`` is
|
|
|
|
removed.
|
|
|
|
|
|
|
|
* The ``WSGIRequest.REQUEST`` property is removed.
|
|
|
|
|
|
|
|
* The class ``django.utils.datastructures.MergeDict`` is removed.
|
|
|
|
|
|
|
|
* The ``zh-cn`` and ``zh-tw`` language codes are removed.
|
|
|
|
|
|
|
|
* The internal ``django.utils.functional.memoize()`` is removed.
|
|
|
|
|
|
|
|
* ``django.core.cache.get_cache`` is removed.
|
|
|
|
|
|
|
|
* ``django.db.models.loading`` is removed.
|
|
|
|
|
|
|
|
* Passing callable arguments to querysets is no longer possible.
|
|
|
|
|
|
|
|
* ``BaseCommand.requires_model_validation`` is removed in favor of
|
|
|
|
``requires_system_checks``. Admin validators is replaced by admin checks.
|
|
|
|
|
2015-01-19 10:57:38 +08:00
|
|
|
* The ``ModelAdmin.validator_class`` and ``default_validator_class`` attributes
|
|
|
|
are removed.
|
|
|
|
|
|
|
|
* ``ModelAdmin.validate()`` is removed.
|
2015-01-17 07:00:45 +08:00
|
|
|
|
|
|
|
* ``django.db.backends.DatabaseValidation.validate_field`` is removed in
|
|
|
|
favor of the ``check_field`` method.
|
|
|
|
|
2015-04-02 04:42:44 +08:00
|
|
|
* The ``validate`` management command is removed.
|
2015-01-18 08:14:44 +08:00
|
|
|
|
2015-01-17 07:00:45 +08:00
|
|
|
* ``django.utils.module_loading.import_by_path`` is removed in favor of
|
|
|
|
``django.utils.module_loading.import_string``.
|
|
|
|
|
|
|
|
* ``ssi`` and ``url`` template tags are removed from the ``future`` template
|
|
|
|
tag library.
|
|
|
|
|
|
|
|
* ``django.utils.text.javascript_quote()`` is removed.
|
|
|
|
|
|
|
|
* Database test settings as independent entries in the database settings,
|
|
|
|
prefixed by ``TEST_``, are no longer supported.
|
|
|
|
|
|
|
|
* The `cache_choices` option to :class:`~django.forms.ModelChoiceField` and
|
|
|
|
:class:`~django.forms.ModelMultipleChoiceField` is removed.
|
|
|
|
|
|
|
|
* The default value of the
|
|
|
|
:attr:`RedirectView.permanent <django.views.generic.base.RedirectView.permanent>`
|
|
|
|
attribute has changed from ``True`` to ``False``.
|
|
|
|
|
|
|
|
* ``django.contrib.sitemaps.FlatPageSitemap`` is removed in favor of
|
|
|
|
``django.contrib.flatpages.sitemaps.FlatPageSitemap``.
|
2015-01-19 10:57:38 +08:00
|
|
|
|
|
|
|
* Private API ``django.test.utils.TestTemplateLoader`` is removed.
|
|
|
|
|
|
|
|
* The ``django.contrib.contenttypes.generic`` module is removed.
|