From 5c5ca08b237ad87e97108b0e1fc727e49e646a00 Mon Sep 17 00:00:00 2001
From: Pakal <chambon.pascal@gmail.com>
Date: Tue, 17 Mar 2015 15:25:07 +0100
Subject: [PATCH 2/2] Add guidance for the disappearance of SortedDict.
---
docs/releases/1.7.txt | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/docs/releases/1.7.txt b/docs/releases/1.7.txt
index 72e8bbe..fd3ab87 100644
a
|
b
|
Python versions, this module isn't useful anymore. It has been deprecated. Use
|
1512 | 1512 | As :class:`~collections.OrderedDict` was added to the standard library in |
1513 | 1513 | Python 2.7, ``SortedDict`` is no longer needed and has been deprecated. |
1514 | 1514 | |
| 1515 | This means that the two additional methods provided by ``SortedDict``, i.e |
| 1516 | ``insert`` and ``value_for_index``, do not exist anymore. |
| 1517 | |
| 1518 | If you relied on these methods to alter structures like form fields, you |
| 1519 | should now consider treating these ordered dicts as immutable objects, and |
| 1520 | override them to change their content. |
| 1521 | |
| 1522 | For example, you might want to override ``MyFormClass.base_fields`` to change |
| 1523 | the ordering of fields for all ``MyFormClass`` instances ; or similarly, you |
| 1524 | could override ``self.fields`` from inside ``MyFormClass.__init__``, to change |
| 1525 | the fields for a particular form instance. Example from the django codebase:: |
| 1526 | |
| 1527 | PasswordChangeForm.base_fields = OrderedDict( |
| 1528 | (k, PasswordChangeForm.base_fields[k]) |
| 1529 | for k in ['old_password', 'new_password1', 'new_password2'] |
| 1530 | ) |
| 1531 | |
| 1532 | |
1515 | 1533 | Custom SQL location for models package |
1516 | 1534 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
1517 | 1535 | |