From 7ee6b2f8b96fcf818585e5894cb53c1e1a1dac35 Mon Sep 17 00:00:00 2001 From: Wes Okes Date: Fri, 8 Dec 2017 14:45:57 -0500 Subject: [PATCH 1/3] django 2 --- .travis.yml | 5 +---- dynamic_initial_data/docs/release_notes.rst | 8 ++++++++ dynamic_initial_data/version.py | 2 +- publish.py | 7 ++++++- setup.py | 6 ++---- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 436adcf..8f94abc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,14 @@ sudo: false language: python python: - - '2.7' - - '3.4' - '3.5' - '3.6' env: global: - DB=postgres matrix: - - DJANGO=">=1.9,<1.10" - - DJANGO=">=1.10,<1.11" - DJANGO=">=1.11,<2.0" + - DJANGO=">=2.0,<2.1" install: - pip install -q coverage flake8 Django$DJANGO django-nose>=1.4 before_script: diff --git a/dynamic_initial_data/docs/release_notes.rst b/dynamic_initial_data/docs/release_notes.rst index d51c830..c8a15df 100644 --- a/dynamic_initial_data/docs/release_notes.rst +++ b/dynamic_initial_data/docs/release_notes.rst @@ -1,6 +1,14 @@ Release Notes ============= +v1.0.0 +------ +* Drop Django 1.9 support +* Drop Django 1.10 support +* Add Django 2.0 support +* Drop python 2.7 support +* Drop python 3.4 support + v0.8.0 ------ * Add python 3.6 support diff --git a/dynamic_initial_data/version.py b/dynamic_initial_data/version.py index 32a90a3..1f356cc 100644 --- a/dynamic_initial_data/version.py +++ b/dynamic_initial_data/version.py @@ -1 +1 @@ -__version__ = '0.8.0' +__version__ = '1.0.0' diff --git a/publish.py b/publish.py index 7fd2587..6b7aa85 100644 --- a/publish.py +++ b/publish.py @@ -1,5 +1,10 @@ import subprocess +subprocess.call(['rm', '-r', 'dist/']) subprocess.call(['pip', 'install', 'wheel']) +subprocess.call(['pip', 'install', 'twine']) subprocess.call(['python', 'setup.py', 'clean', '--all']) -subprocess.call(['python', 'setup.py', 'register', 'sdist', 'bdist_wheel', 'upload']) +subprocess.call(['python', 'setup.py', 'register', 'sdist', 'bdist_wheel']) +subprocess.call(['twine', 'upload', 'dist/*']) +subprocess.call(['rm', '-r', 'dist/']) +subprocess.call(['rm', '-r', 'build/']) diff --git a/setup.py b/setup.py index 8348ca4..8627dac 100644 --- a/setup.py +++ b/setup.py @@ -29,8 +29,6 @@ def get_version(): packages=find_packages(), classifiers=[ 'Programming Language :: Python', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Intended Audience :: Developers', @@ -40,8 +38,8 @@ def get_version(): ], license='MIT', install_requires=[ - 'Django>=1.9', - 'django-manager-utils>=0.13.0', + 'Django>=1.11', + 'django-manager-utils>=1.0.0', ], tests_require=[ 'psycopg2', From 647f03d78224e723477c591449ecff92b903a3f6 Mon Sep 17 00:00:00 2001 From: Wes Okes Date: Fri, 8 Dec 2017 15:32:56 -0500 Subject: [PATCH 2/3] on delete --- dynamic_initial_data/migrations/0001_initial.py | 3 ++- dynamic_initial_data/models.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dynamic_initial_data/migrations/0001_initial.py b/dynamic_initial_data/migrations/0001_initial.py index f1cb3b4..62c63c1 100644 --- a/dynamic_initial_data/migrations/0001_initial.py +++ b/dynamic_initial_data/migrations/0001_initial.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.db import models, migrations +import django.db.models.deletion class Migration(migrations.Migration): @@ -17,7 +18,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)), ('model_obj_id', models.PositiveIntegerField()), ('register_time', models.DateTimeField()), - ('model_obj_type', models.ForeignKey(to='contenttypes.ContentType')), + ('model_obj_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')), ], options={ }, diff --git a/dynamic_initial_data/models.py b/dynamic_initial_data/models.py index 707c09f..a7e8e61 100644 --- a/dynamic_initial_data/models.py +++ b/dynamic_initial_data/models.py @@ -10,7 +10,7 @@ class RegisteredForDeletionReceipt(models.Model): initial data process. """ # The model object that was registered - model_obj_type = models.ForeignKey(ContentType) + model_obj_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) model_obj_id = models.PositiveIntegerField() model_obj = GenericForeignKey('model_obj_type', 'model_obj_id', for_concrete_model=False) From ef9bf0dafda4a40593ee89e0c02694e5d86ea6a1 Mon Sep 17 00:00:00 2001 From: Wes Okes Date: Fri, 8 Dec 2017 15:36:12 -0500 Subject: [PATCH 3/3] noqa --- dynamic_initial_data/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dynamic_initial_data/base.py b/dynamic_initial_data/base.py index c5e6837..399f8e4 100644 --- a/dynamic_initial_data/base.py +++ b/dynamic_initial_data/base.py @@ -173,7 +173,7 @@ def handle_deletions(self): for receipt in RegisteredForDeletionReceipt.objects.exclude(register_time=now): try: receipt.model_obj.delete() - except: + except: # noqa # The model object may no longer be there, its ctype may be invalid, or it might be protected. # Regardless, the model object cannot be deleted, so go ahead and delete its receipt. pass