Jelajahi Sumber

Fix import compatibility

Denis K 9 tahun lalu
induk
melakukan
5b9cdd3986
1 mengubah file dengan 11 tambahan dan 3 penghapusan
  1. 11 3
      jet/filters.py

+ 11 - 3
jet/filters.py

@@ -1,9 +1,17 @@
 from django.contrib.admin import RelatedFieldListFilter
-from django.contrib.admin.utils import get_model_from_relation
-from django.core.urlresolvers import reverse
-from django.forms.utils import flatatt
 from django.utils.encoding import smart_text
 from django.utils.html import format_html
+from django.core.urlresolvers import reverse
+
+try:
+    from django.contrib.admin.utils import get_model_from_relation
+except ImportError: # Django 1.6
+    from django.contrib.admin.util import get_model_from_relation
+
+try:
+    from django.forms.utils import flatatt
+except ImportError: # Django 1.6
+    from django.forms.util import flatatt
 
 
 class RelatedFieldAjaxListFilter(RelatedFieldListFilter):