Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django 2.1 support #32

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 33 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,39 @@
language: python

matrix:
include:
- python: 2.7
env:
- TOXENV=django19-py27
- TOXENV=django110-py27
- TOXENV=django111-py27
- python: 3.6
env:
- TOXENV=django19-py36
- TOXENV=django110-py36
- TOXENV=django111-py36
include:
- python: 2.7
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List these envs the same way please. No need for the separation the be this granular.

env: TOXENV=django111-py27
- python: 3.5
env: TOXENV=django111-py35
- python: 3.5
env: TOXENV=django20-py35
- python: 3.5
env: TOXENV=django21-py35
- python: 3.6
env: TOXENV=django111-py36
- python: 3.6
env: TOXENV=django20-py36
- python: 3.6
env: TOXENV=django21-py36
- python: 3.7
dist: xenial
sudo: true
env: TOXENV=django111-py37
- python: 3.7
dist: xenial
sudo: true
env: TOXENV=django20-py37
- python: 3.7
dist: xenial
sudo: true
env: TOXENV=django21-py37

install:
- pip install tox
- pip install coveralls
script:
- tox

script: tox

after_success:
- coveralls
- coveralls
25 changes: 24 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,25 @@ Django Export
.. image:: https://travis-ci.org/praekelt/django-export.svg
:target: https://travis-ci.org/praekelt/django-export

.. image:: https://coveralls.io/repos/github/praekelt/django-export/badge.svg?branch=develop
:target: https://coveralls.io/github/praekelt/django-export?branch=develop

.. image:: https://badge.fury.io/py/django-export.svg
:target: https://badge.fury.io/py/django-export

django-export allows you to export model objects in a wide range of serialized formats (JSON, CSV, XML, YAML). Exports can be filtered and ordered on any of the particular model's fields.

django-export utilizes `django-object-tools <http://pypi.python.org/pypi/django-object-tools>`_ to hook into Django's admin interface and take care of user permissions.

.. contents:: Contents
:depth: 5

Requirements
------------

#. Python 2.7, 3.5-3.7

#. Django 1.11, 2.0, 2.1

Installation
------------
Expand All @@ -20,7 +32,16 @@ Installation

#. Install or add ``django-export`` to your Python path.

#. Add ``export`` to your ``INSTALLED_APPS`` setting.
#. Add ``export`` to your ``INSTALLED_APPS`` setting. Note the order should be as below
.. code-block:: python

INSTALLED_APPS = [
...
'object_tools',
'export',
'django.contrib.admin',
...
]

#. Optionally for exporting in CSV you need to add ``export.serializers.csv_serializer`` to your ``SERIALIZATION_MODULES`` setting, i.e.:

Expand All @@ -30,6 +51,8 @@ Installation
'csv': 'export.serializers.csv_serializer'
}

#. Remember to run ``migrate`` whenever you install new tools to setup permissions.

Usage
-----

Expand Down
2 changes: 2 additions & 0 deletions export/tests/requirements/111.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Django~=1.11.15
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These requirements can be listed directly in the tox.ini file. No need for separate files for two requirements.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

django-object-tools==1.9
2 changes: 2 additions & 0 deletions export/tests/requirements/20.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Django>=2.0,<2.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above about requirements

django-object-tools==2.0
2 changes: 2 additions & 0 deletions export/tests/requirements/21.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Django>=2.1,<2.2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above about requirements

django-object-tools==2.0
2 changes: 1 addition & 1 deletion test_settings.py → export/tests/settings/111.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DEBUG = True
USE_TZ = True

DATABASE_ENGINE = 'sqlite3'

Expand Down
62 changes: 62 additions & 0 deletions export/tests/settings/20.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
USE_TZ = True

DATABASE_ENGINE = 'sqlite3'

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}

SECRET_KEY = '123'

INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.sessions',
'object_tools',
'export'
]

SERIALIZATION_MODULES = {
'csv': 'export.serializers.csv_serializer'
}

EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'

ROOT_URLCONF = 'object_tools.tests.urls'
STATIC_URL = '/static/'

TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [
],
"OPTIONS": {
"context_processors": [
"django.contrib.auth.context_processors.auth",
"django.template.context_processors.debug",
"django.template.context_processors.i18n",
"django.template.context_processors.media",
"django.template.context_processors.static",
"django.template.context_processors.tz",
"django.template.context_processors.request",
"django.contrib.messages.context_processors.messages",
],
"loaders": [
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
]
},
},
]

MIDDLEWARE = (
"django.middleware.common.CommonMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware"
)
62 changes: 62 additions & 0 deletions export/tests/settings/21.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
USE_TZ = True

DATABASE_ENGINE = 'sqlite3'

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}

SECRET_KEY = '123'

INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.sessions',
'object_tools',
'export'
]

SERIALIZATION_MODULES = {
'csv': 'export.serializers.csv_serializer'
}

EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'

ROOT_URLCONF = 'object_tools.tests.urls'
STATIC_URL = '/static/'

TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [
],
"OPTIONS": {
"context_processors": [
"django.contrib.auth.context_processors.auth",
"django.template.context_processors.debug",
"django.template.context_processors.i18n",
"django.template.context_processors.media",
"django.template.context_processors.static",
"django.template.context_processors.tz",
"django.template.context_processors.request",
"django.contrib.messages.context_processors.messages",
],
"loaders": [
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
]
},
},
]

MIDDLEWARE = (
"django.middleware.common.CommonMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware"
)
Empty file.
1 change: 1 addition & 0 deletions export/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,5 @@ def view(self, request, extra_context=None, process_form=True):
context,
)


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PEP 8: expected 2 blank lines after class or function definition, found 1

object_tools.tools.register(Export)
21 changes: 15 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,32 @@
author_email='[email protected]',
url='http://github.com/praekelt/django-export',
packages=find_packages(),
include_package_data=True,
install_requires=[
'django-object-tools',
'pyyaml>=3.11'
'django-object-tools>=2.0'
],
tests_require=[
'django-setuptest>=0.1',
'django-object-tools>=2.0',
'tox'
],
include_package_data=True,
test_suite="setuptest.setuptest.SetupTestSuite",
test_suite="tox",
classifiers=[
"Programming Language :: Python",
"License :: OSI Approved :: BSD License",
"Development Status :: 4 - Beta",
"Operating System :: OS Independent",
"Framework :: Django",
"Framework :: Django :: 1.11",
"Framework :: Django :: 2.0",
"Framework :: Django :: 2.1",
"Intended Audience :: Developers",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
],
zip_safe=False,
)
17 changes: 10 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
[tox]
envlist =
django111-{py27,py36},
django110-{py27,py36},
django19-{py27,py36},
django111-py27
{django111,django20,django21}-{py35,py36,py37}

[testenv]
commands =
coverage run manage.py test export.tests --settings=test_settings
coverage report -m
coverage run manage.py test
deps =
coverage
django111: django>=1.11,<2.0
django110: django>=1.10,<1.11
django19: django>=1.9,<1.10
django20: django>=2.0,<2.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeing that you have these here, all the requirements files for the tests can be removed

django21: django>=2.1,<2.2

setenv =
django111: DJANGO_SETTINGS_MODULE=export.tests.settings.111
django20: DJANGO_SETTINGS_MODULE=export.tests.settings.20
django21: DJANGO_SETTINGS_MODULE=export.tests.settings.21