Skip to content

Commit

Permalink
fixes for Django 1.10, test in allow-failure mode
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrDlouhy committed Dec 29, 2015
1 parent cfdb860 commit c8938ba
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 11 deletions.
19 changes: 12 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,23 @@ 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:
- python tests/manage.py test core --settings=
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"
6 changes: 4 additions & 2 deletions import_export/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
5 changes: 4 additions & 1 deletion import_export/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
11 changes: 11 additions & 0 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
15 changes: 14 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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}

0 comments on commit c8938ba

Please sign in to comment.