mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Deprecated SortedDict (replaced with collections.OrderedDict)
Thanks Loic Bistuer for the review.
This commit is contained in:
committed by
Tim Graham
parent
b278f7478d
commit
07876cf02b
@@ -423,6 +423,9 @@ these changes.
|
||||
* FastCGI support via the ``runfcgi`` management command will be
|
||||
removed. Please deploy your project using WSGI.
|
||||
|
||||
* ``django.utils.datastructures.SortedDict`` will be removed. Use
|
||||
:class:`collections.OrderedDict` from the Python standard library instead.
|
||||
|
||||
2.0
|
||||
---
|
||||
|
||||
|
||||
@@ -977,14 +977,13 @@ of the arguments is required, but you should use at least one of them.
|
||||
``select_params`` parameter. Since ``select_params`` is a sequence and
|
||||
the ``select`` attribute is a dictionary, some care is required so that
|
||||
the parameters are matched up correctly with the extra select pieces.
|
||||
In this situation, you should use a
|
||||
:class:`django.utils.datastructures.SortedDict` for the ``select``
|
||||
value, not just a normal Python dictionary.
|
||||
In this situation, you should use a :class:`collections.OrderedDict` for
|
||||
the ``select`` value, not just a normal Python dictionary.
|
||||
|
||||
This will work, for example::
|
||||
|
||||
Blog.objects.extra(
|
||||
select=SortedDict([('a', '%s'), ('b', '%s')]),
|
||||
select=OrderedDict([('a', '%s'), ('b', '%s')]),
|
||||
select_params=('one', 'two'))
|
||||
|
||||
The only thing to be careful about when using select parameters in
|
||||
|
||||
@@ -105,6 +105,10 @@ to distinguish caches by the ``Accept-language`` header.
|
||||
|
||||
.. class:: SortedDict
|
||||
|
||||
.. deprecated:: 1.7
|
||||
``SortedDict`` is deprecated and will be removed in Django 1.9. Use
|
||||
:class:`collections.OrderedDict` instead.
|
||||
|
||||
The :class:`django.utils.datastructures.SortedDict` class is a dictionary
|
||||
that keeps its keys in the order in which they're inserted.
|
||||
|
||||
|
||||
@@ -167,6 +167,13 @@ on all Python versions. Since ``unittest2`` became the standard library's
|
||||
Python versions, this module isn't useful anymore. It has been deprecated. Use
|
||||
:mod:`unittest` instead.
|
||||
|
||||
``django.utils.datastructures.SortedDict``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
As :class:`~collections.OrderedDict` was added to the standard library in
|
||||
Python 2.7, :class:`~django.utils.datastructures.SortedDict` is no longer
|
||||
needed and has been deprecated.
|
||||
|
||||
Custom SQL location for models package
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
Reference in New Issue
Block a user