diff --git a/.travis.yml b/.travis.yml index d67a03955..82e3e87f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,13 +4,14 @@ python: - "3.3" - "3.4" env: - - DJANGO=1.5.5 - - DJANGO=1.6.1 - - DJANGO=1.7.0 - - DJANGO=1.8 - - DJANGO=1.9 + - DJANGO="Django>=1.5,<1.6" + - DJANGO="Django>=1.6,<1.7" + - DJANGO="Django>=1.7,<1.8" + - DJANGO="Django>=1.8,<1.9" + - DJANGO="Django>=1.9,<1.10" + - DJANGO="https://github.com/django/django/archive/master.tar.gz" install: - - pip install -q Django==$DJANGO --use-mirrors + - pip install -q $DJANGO --use-mirrors - pip install -e git+https://github.com/kennethreitz/tablib.git#egg=tablib - pip install -r requirements/base.txt --use-mirrors script: @@ -18,4 +19,8 @@ script: matrix: exclude: - python: "3.3" - env: DJANGO=1.9 + env: DJANGO="Django>=1.9,<1.10" + - python: "3.3" + env: DJANGO="https://github.com/django/django/archive/master.tar.gz" + allow_failures: + - env: DJANGO="https://github.com/django/django/archive/master.tar.gz" diff --git a/import_export/admin.py b/import_export/admin.py index a30030287..e0627fb9a 100644 --- a/import_export/admin.py +++ b/import_export/admin.py @@ -249,8 +249,9 @@ def import_action(self, request, *args, **kwargs): context['opts'] = self.model._meta context['fields'] = [f.column_name for f in resource.get_fields()] + request.current_app = self.admin_site.name return TemplateResponse(request, [self.import_template_name], - context, current_app=self.admin_site.name) + context) class ExportMixin(ImportExportMixinBase): @@ -365,8 +366,9 @@ def export_action(self, request, *args, **kwargs): context['form'] = form context['opts'] = self.model._meta + request.current_app = self.admin_site.name return TemplateResponse(request, [self.export_template_name], - context, current_app=self.admin_site.name) + context) class ImportExportMixin(ImportMixin, ExportMixin): diff --git a/import_export/resources.py b/import_export/resources.py index f5a333e04..184dc025b 100644 --- a/import_export/resources.py +++ b/import_export/resources.py @@ -489,7 +489,10 @@ def __new__(cls, name, bases, attrs): verbose_path = ".".join([opts.model.__name__] + attrs[0:i+1]) try: - f = model._meta.get_field_by_name(attr)[0] + try: + f = model._meta.get_field_by_name(attr)[0] + except AttributeError: # Django > 1.10 + f = model._meta.get_field(attr) except FieldDoesNotExist as e: logging.exception(e) raise FieldDoesNotExist( diff --git a/tests/settings.py b/tests/settings.py index 390a632f7..76aac5ebc 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -33,6 +33,17 @@ 'django.middleware.clickjacking.XFrameOptionsMiddleware', ) +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': {'django.contrib.messages.context_processors.messages',}, + }, + }, +] + if os.environ.get('IMPORT_EXPORT_TEST_TYPE') == 'mysql-innodb': IMPORT_EXPORT_USE_TRANSACTIONS = True DATABASES = { diff --git a/tox.ini b/tox.ini index 940f72264..697301a3f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27-1.5, py27-1.6, py33-1.6, py27-1.7, py33-1.7, py34-1.7, py27-1.8, py33-1.8, py34-1.8, py27-1.9, py34-1.9 +envlist = py27-1.5, py27-1.6, py33-1.6, py27-1.7, py33-1.7, py34-1.7, py27-1.8, py33-1.8, py34-1.8, py27-1.9, py34-1.9, py27-dev, py34-dev [testenv] commands=python {toxinidir}/tests/manage.py test core @@ -76,3 +76,16 @@ deps = django==1.9 -egit+https://github.com/kennethreitz/tablib.git#egg=tablib {[testenv]deps} + +[testenv:py27-dev] +basepython = python2.7 +deps = + https://github.com/django/django/archive/master.tar.gz + {[testenv]deps} + +[testenv:py34-dev] +basepython = python3.4 +deps = + https://github.com/django/django/archive/master.tar.gz + -egit+https://github.com/kennethreitz/tablib.git#egg=tablib + {[testenv]deps}