diff --git a/django_elasticsearch/managers.py b/django_elasticsearch/managers.py index c62a7e7..c5d7f2a 100644 --- a/django_elasticsearch/managers.py +++ b/django_elasticsearch/managers.py @@ -11,6 +11,12 @@ from django_elasticsearch.query import EsQueryset from django_elasticsearch.client import es_client + +try: + basestring #py2 +except NameError: + basestring = str #py3 + # Note: we use long/double because different db backends # could store different sizes of numerics ? # Note: everything else is mapped to a string diff --git a/django_elasticsearch/tests/test_serializer.py b/django_elasticsearch/tests/test_serializer.py index 5dd1def..93436a8 100644 --- a/django_elasticsearch/tests/test_serializer.py +++ b/django_elasticsearch/tests/test_serializer.py @@ -10,6 +10,11 @@ from test_app.models import Test2Model +try: + basestring #py2 +except NameError: + basestring = str #py3 + class CustomSerializer(EsJsonSerializer): def serialize_char(self, instance, field_name): return u'FOO'