aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/compat.py
diff options
context:
space:
mode:
authorÒscar Vilaplana2013-05-19 01:59:19 -0700
committerÒscar Vilaplana2013-05-19 01:59:19 -0700
commit42b61ffcd7dd5091846d884cba34f3a82dcf81f4 (patch)
treeb33a515f024a93051424318b2c6d1a291fee5198 /rest_framework/compat.py
parentfecadacab150aab48b8b84f4f0e5340ead74c287 (diff)
parentc0f3a1c397a564ee78b3a656f14f7ff46b0d2b31 (diff)
downloaddjango-rest-framework-42b61ffcd7dd5091846d884cba34f3a82dcf81f4.tar.bz2
Merge pull request #1 from nschlemm/issue-192-expose-fields-for-options
Merged work in progress for Issue 192 expose fields for options
Diffstat (limited to 'rest_framework/compat.py')
-rw-r--r--rest_framework/compat.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/rest_framework/compat.py b/rest_framework/compat.py
index cd39f544..76dc0052 100644
--- a/rest_framework/compat.py
+++ b/rest_framework/compat.py
@@ -495,3 +495,16 @@ except ImportError:
oauth2_provider_forms = None
oauth2_provider_scope = None
oauth2_constants = None
+
+# Handle lazy strings
+from django.utils.functional import Promise
+
+if six.PY3:
+ def is_non_str_iterable(obj):
+ if (isinstance(obj, str) or
+ (isinstance(obj, Promise) and obj._delegate_text)):
+ return False
+ return hasattr(obj, '__iter__')
+else:
+ def is_non_str_iterable(obj):
+ return hasattr(obj, '__iter__')