1. psilar
  2. django-selectable

Commits

Mark Lavin  committed 8e9430f

Fix moved reduce function in Python 3 and use importlib for finding lookup classes.

  • Participants
  • Parent commits b7072d3
  • Branches default

Comments (0)

Files changed (2)

File selectable/base.py

View file
  • Ignore whitespace
 import json
 import operator
 import re
+from functools import reduce
 
 from django.conf import settings
 from django.core.paginator import Paginator, InvalidPage, EmptyPage

File selectable/forms/base.py

View file
  • Ignore whitespace
 
 from django import forms
 from django.conf import settings
-
+from django.utils.importlib import import_module
 
 from selectable.compat import string_types
 
     from selectable.base import LookupBase
     if isinstance(lookup_class, string_types):
         mod_str, cls_str = lookup_class.rsplit('.', 1)
-        mod = __import__(mod_str, fromlist=[cls_str])
+        mod = import_module(mod_str)
         lookup_class = getattr(mod, cls_str)
     if not issubclass(lookup_class, LookupBase):
         raise TypeError('lookup_class must extend from selectable.base.LookupBase')