From 7dd39d52a11909252cc47392f85f9ed8b7139088 Mon Sep 17 00:00:00 2001 From: Matt Molyneaux Date: Thu, 6 Jun 2019 01:25:17 +0100 Subject: [PATCH] Test against Django 2.2 (#14) - Add Django 2.2 to tox.ini - Add migraions to example app - Tell flake8 to ignore migrations --- README.rst | 2 +- .../download/migrations/0001_initial.py | 27 +++++++++++++++++++ .../download/migrations/__init__.py | 0 examples/protected_downloads/settings.py | 21 ++++++++++++++- tox.ini | 14 +++++++--- 5 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 examples/protected_downloads/download/migrations/0001_initial.py create mode 100644 examples/protected_downloads/download/migrations/__init__.py diff --git a/README.rst b/README.rst index 4fffd3f..e6112e8 100644 --- a/README.rst +++ b/README.rst @@ -63,7 +63,7 @@ etc is done elsewhere. Supported Django Versions ========================= -Django 1.8 to 2.1 is currently supported by this library. +Django 1.8 to 2.2 is currently supported by this library. Installation ============ diff --git a/examples/protected_downloads/download/migrations/0001_initial.py b/examples/protected_downloads/download/migrations/0001_initial.py new file mode 100644 index 0000000..11a7643 --- /dev/null +++ b/examples/protected_downloads/download/migrations/0001_initial.py @@ -0,0 +1,27 @@ +# Generated by Django 2.2.2 on 2019-06-05 19:03 + +from django.conf import settings +import django.core.files.storage +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Download', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('is_public', models.BooleanField(default=True)), + ('title', models.CharField(max_length=255)), + ('file', models.FileField(storage=django.core.files.storage.FileSystemStorage(location='/home/moggers/workspace/django-sendfile2/examples/protected_downloads/protected'), upload_to='download')), + ('users', models.ManyToManyField(blank=True, to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/examples/protected_downloads/download/migrations/__init__.py b/examples/protected_downloads/download/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/examples/protected_downloads/settings.py b/examples/protected_downloads/settings.py index 98a9621..da71155 100644 --- a/examples/protected_downloads/settings.py +++ b/examples/protected_downloads/settings.py @@ -61,10 +61,11 @@ # 'django.template.loaders.eggs.load_template_source', ) -MIDDLEWARE_CLASSES = ( +MIDDLEWARE = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', ) ROOT_URLCONF = 'urls' @@ -73,12 +74,30 @@ os.path.join(PROJECT_ROOT, 'templates'), ) +TEMPLATES = [{ + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'OPTIONS': { + 'context_processors': [ + "django.contrib.auth.context_processors.auth", + "django.contrib.messages.context_processors.messages", + ], + 'loaders': [ + ( + 'django.template.loaders.filesystem.Loader', + 'django.template.loaders.app_directories.Loader', + ), + ], + 'debug': DEBUG, # noqa: F405 + }, +}] + INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', + 'django.contrib.messages', 'download', 'sendfile', ) diff --git a/tox.ini b/tox.ini index c73864d..fce4dca 100644 --- a/tox.ini +++ b/tox.ini @@ -2,9 +2,9 @@ envlist = {pypy,py27}-django{18,19,110,111} py34-django{18,19,110,111,20} - py35-django{18,19,110,111,20,21} - py36-django{111,20,21} - py37-django{20,21} + py35-django{18,19,110,111,20,21,22} + py36-django{111,20,21,22} + py37-django{20,21,22} flake8 [testenv] @@ -16,6 +16,7 @@ deps = django111: Django>=1.11,<1.12 django20: Django>=2.0,<2.1 django21: Django>=2.1,<2.2 + django22: Django>=2.2,<2.3 changedir = examples/protected_downloads commands = python manage.py test sendfile {posargs} @@ -28,6 +29,13 @@ deps=flake8 [flake8] max_line_length=100 +exclude = + .git + env + */migrations/* + .tox + __pycache__ + docs [travis] python =