Skip to content

Commit 7fb0ecd

Browse files
committed
fix importing six on django < 2
1 parent cc5b136 commit 7fb0ecd

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

ajax_select/fields.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
import json
44
import sys
5-
from six import text_type
5+
6+
from ajax_select.registry import registry
67
from django import forms
78
from django.conf import settings
89
from django.contrib.contenttypes.models import ContentType
@@ -14,7 +15,11 @@
1415
from django.utils.module_loading import import_string
1516
from django.utils.safestring import mark_safe
1617

17-
from ajax_select.registry import registry
18+
try:
19+
from six import text_type
20+
except ImportError:
21+
from django.utils.six import text_type
22+
1823

1924
if sys.version_info.major >= 3:
2025
from django.utils.translation import gettext as _

example/example/lookups.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
from __future__ import unicode_literals
22

3+
import ajax_select
4+
from ajax_select import LookupChannel
35
from django.db.models import Q
46
from django.utils.html import escape
5-
from django.utils.six import text_type
7+
68
from example.models import Group, Person, Song
79

8-
import ajax_select
9-
from ajax_select import LookupChannel
10+
try:
11+
from six import text_type
12+
except ImportError:
13+
from django.utils.six import text_type
1014

1115

1216
class PersonLookup(LookupChannel):

0 commit comments

Comments
 (0)