From 149817b23b24c2e2ba4a309b1554743952cfc9df Mon Sep 17 00:00:00 2001 From: Jonas Genannt Date: Tue, 17 Oct 2017 21:45:43 +0200 Subject: [PATCH 1/3] Django 2.0: added on_delete argument --- mailqueue/migrations/0001_initial.py | 7 ++++++- mailqueue/models.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mailqueue/migrations/0001_initial.py b/mailqueue/migrations/0001_initial.py index d0a8339..6e96de1 100644 --- a/mailqueue/migrations/0001_initial.py +++ b/mailqueue/migrations/0001_initial.py @@ -50,7 +50,12 @@ class Migration(migrations.Migration): migrations.AddField( model_name='attachment', name='email', - field=models.ForeignKey(blank=True, to='mailqueue.MailerMessage', null=True), + field=models.ForeignKey( + on_delete=models.CASCADE, + blank=True, + to='mailqueue.MailerMessage', + null=True, + ), preserve_default=True, ), ] diff --git a/mailqueue/models.py b/mailqueue/models.py index 81dfa5b..bec1173 100644 --- a/mailqueue/models.py +++ b/mailqueue/models.py @@ -143,7 +143,7 @@ class Attachment(models.Model): file_attachment = models.FileField(storage=get_storage(), upload_to=upload_to, blank=True, null=True) original_filename = models.CharField(default=None, max_length=250, blank=False) - email = models.ForeignKey(MailerMessage, blank=True, null=True) + email = models.ForeignKey(MailerMessage, on_delete=models.CASCADE, blank=True, null=True) class Meta: verbose_name = _('Attachment') From 53946cfea385224770e765c027cf873cfc60c05b Mon Sep 17 00:00:00 2001 From: Jonas Genannt Date: Thu, 7 Dec 2017 19:24:29 +0100 Subject: [PATCH 2/3] Django 2 travis checks --- .travis.yml | 23 ++++++++++++++--------- mailqueue/migrations/0001_initial.py | 2 +- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 63add2a..ed1703a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,19 @@ language: python -python: - - "2.7" - - "3.4" - -env: - - DJANGO_VERSION=Django==1.8 - - DJANGO_VERSION=Django==1.9 - - DJANGO_VERSION=Django==1.10 - - DJANGO_VERSION=Django==1.11 +matrix: + include: + - python: 2.7 + env: + - DJANGO_VERSION=Django==1.8 + - DJANGO_VERSION=Django==1.9 + - DJANGO_VERSION=Django==1.10 + - DJANGO_VERSION=Django==1.11 + - python: 3.4 + - DJANGO_VERSION=Django==1.8 + - DJANGO_VERSION=Django==1.9 + - DJANGO_VERSION=Django==1.10 + - DJANGO_VERSION=Django==1.11 + - DJANGO_VERSION=Django==2.0 # command to install dependencies install: diff --git a/mailqueue/migrations/0001_initial.py b/mailqueue/migrations/0001_initial.py index 6e96de1..819ce01 100644 --- a/mailqueue/migrations/0001_initial.py +++ b/mailqueue/migrations/0001_initial.py @@ -51,7 +51,7 @@ class Migration(migrations.Migration): model_name='attachment', name='email', field=models.ForeignKey( - on_delete=models.CASCADE, + on_delete=models.deletion.CASCADE, blank=True, to='mailqueue.MailerMessage', null=True, From f5d0b04b7dcb509b71ddc6353f71b4a52bf7dda8 Mon Sep 17 00:00:00 2001 From: Jonas Genannt Date: Thu, 7 Dec 2017 19:29:22 +0100 Subject: [PATCH 3/3] Update travis file --- .travis.yml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index ed1703a..c66befc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,17 +3,23 @@ language: python matrix: include: - python: 2.7 - env: - - DJANGO_VERSION=Django==1.8 - - DJANGO_VERSION=Django==1.9 - - DJANGO_VERSION=Django==1.10 - - DJANGO_VERSION=Django==1.11 + env: DJANGO_VERSION=Django==1.8 + - python: 2.7 + env: DJANGO_VERSION=Django==1.9 + - python: 2.7 + env: DJANGO_VERSION=Django==1.10 + - python: 2.7 + env: DJANGO_VERSION=Django==1.11 + - python: 3.4 + env: DJANGO_VERSION=Django==1.8 + - python: 3.4 + env: DJANGO_VERSION=Django==1.9 + - python: 3.4 + env: DJANGO_VERSION=Django==1.10 + - python: 3.4 + env: DJANGO_VERSION=Django==1.11 - python: 3.4 - - DJANGO_VERSION=Django==1.8 - - DJANGO_VERSION=Django==1.9 - - DJANGO_VERSION=Django==1.10 - - DJANGO_VERSION=Django==1.11 - - DJANGO_VERSION=Django==2.0 + env: DJANGO_VERSION=Django==2.0 # command to install dependencies install: