From 68c3e95b188829df0d48869eff6d626adc82260a Mon Sep 17 00:00:00 2001 From: Amir Qayyum Khan Date: Mon, 16 Jul 2018 15:31:05 +0500 Subject: [PATCH] Provide support for Django 2.0+ --- dj_elastictranscoder/__init__.py | 2 +- dj_elastictranscoder/migrations/0001_initial.py | 3 ++- dj_elastictranscoder/models.py | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dj_elastictranscoder/__init__.py b/dj_elastictranscoder/__init__.py index fac5bf4..d0564e5 100644 --- a/dj_elastictranscoder/__init__.py +++ b/dj_elastictranscoder/__init__.py @@ -1 +1 @@ -__version__ = '0.9.6' +__version__ = '0.9.7' diff --git a/dj_elastictranscoder/migrations/0001_initial.py b/dj_elastictranscoder/migrations/0001_initial.py index 8b63d7c..3b19420 100644 --- a/dj_elastictranscoder/migrations/0001_initial.py +++ b/dj_elastictranscoder/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): @@ -20,7 +21,7 @@ class Migration(migrations.Migration): ('message', models.TextField()), ('created_at', models.DateTimeField(auto_now_add=True)), ('last_modified', models.DateTimeField(auto_now=True)), - ('content_type', models.ForeignKey(to='contenttypes.ContentType')), + ('content_type', models.ForeignKey(to='contenttypes.ContentType', on_delete=django.db.models.deletion.CASCADE)), ], ), ] diff --git a/dj_elastictranscoder/models.py b/dj_elastictranscoder/models.py index 60f0145..3c1323a 100644 --- a/dj_elastictranscoder/models.py +++ b/dj_elastictranscoder/models.py @@ -3,7 +3,6 @@ from django.contrib.contenttypes.fields import GenericForeignKey - class EncodeJob(models.Model): STATE_CHOICES = ( (0, 'Submitted'), @@ -13,7 +12,7 @@ class EncodeJob(models.Model): (4, 'Complete'), ) id = models.CharField(max_length=100, primary_key=True) - content_type = models.ForeignKey(ContentType) + content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) object_id = models.PositiveIntegerField() state = models.PositiveIntegerField(choices=STATE_CHOICES, default=0, db_index=True) content_object = GenericForeignKey()