diff options
Diffstat (limited to 'rest_framework/compat.py')
| -rw-r--r-- | rest_framework/compat.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/rest_framework/compat.py b/rest_framework/compat.py index 0201bd83..5bd85e74 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -26,6 +26,16 @@ except ImportError: from django.utils.encoding import force_unicode as force_text +# OrderedDict only available in Python 2.7. +# This will always be the case in Django 1.7 and above, as these versions +# no longer support Python 2.6. +# For Django <= 1.6 and Python 2.6 fall back to OrderedDict. +try: + from collections import OrderedDict +except: + from django.utils.datastructures import SortedDict as OrderedDict + + # HttpResponseBase only exists from 1.5 onwards try: from django.http.response import HttpResponseBase |
