diff options
| author | Tom Christie | 2014-11-06 12:00:30 +0000 | 
|---|---|---|
| committer | Tom Christie | 2014-11-06 12:00:30 +0000 | 
| commit | 4e001dbb7ac0bc13d6d5fbb4524e905184610aa2 (patch) | |
| tree | f653aa5d1e0eaff780ba52039f29085e4bc8f54c /rest_framework/fields.py | |
| parent | 9923a6ce9013693ea1723e7895b3cab638d719fd (diff) | |
| download | django-rest-framework-4e001dbb7ac0bc13d6d5fbb4524e905184610aa2.tar.bz2 | |
Drop usage of SortedDict. Closes #2027.
Diffstat (limited to 'rest_framework/fields.py')
| -rw-r--r-- | rest_framework/fields.py | 7 | 
1 files changed, 3 insertions, 4 deletions
| diff --git a/rest_framework/fields.py b/rest_framework/fields.py index a9e2e48b..71377326 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -4,14 +4,13 @@ from django.core.exceptions import ValidationError as DjangoValidationError  from django.core.validators import RegexValidator  from django.forms import ImageField as DjangoImageField  from django.utils import six, timezone -from django.utils.datastructures import SortedDict  from django.utils.dateparse import parse_date, parse_datetime, parse_time  from django.utils.encoding import is_protected_type  from django.utils.translation import ugettext_lazy as _  from rest_framework import ISO_8601  from rest_framework.compat import (      smart_text, EmailValidator, MinValueValidator, MaxValueValidator, -    MinLengthValidator, MaxLengthValidator, URLValidator +    MinLengthValidator, MaxLengthValidator, URLValidator, OrderedDict  )  from rest_framework.exceptions import ValidationError  from rest_framework.settings import api_settings @@ -917,9 +916,9 @@ class ChoiceField(Field):              for item in choices          ]          if all(pairs): -            self.choices = SortedDict([(key, display_value) for key, display_value in choices]) +            self.choices = OrderedDict([(key, display_value) for key, display_value in choices])          else: -            self.choices = SortedDict([(item, item) for item in choices]) +            self.choices = OrderedDict([(item, item) for item in choices])          # Map the string representation of choices to the underlying value.          # Allows us to deal with eg. integer choices while supporting either | 
