From 455738107165ad722ab8f93c2fdd100cb0ce0a46 Mon Sep 17 00:00:00 2001 From: Peter Wischer Date: Mon, 29 Apr 2019 16:32:10 +0200 Subject: [PATCH] Add 'on_delete=models.CASCADE' --- CHANGELOG.rst | 1 + aldryn_locations/migrations/0001_initial.py | 15 ++++++++------- .../migrations/0003_path file location.py | 3 ++- .../migrations/0004_auto_20160914_1511.py | 15 ++++++++------- aldryn_locations/models.py | 4 ++++ 5 files changed, 23 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 034ba52..639a194 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,6 +7,7 @@ CHANGELOG * Fix unicode error in python 3 * Fix for 'query' field not used in model for Django 1.11 * Fix leaking the admin url when accessed without login +* Add 'on_delete=models.CASCADE' required for Django 2.0 1.1.3 (2016-10-11) diff --git a/aldryn_locations/migrations/0001_initial.py b/aldryn_locations/migrations/0001_initial.py index 660d82e..ee61bf6 100644 --- a/aldryn_locations/migrations/0001_initial.py +++ b/aldryn_locations/migrations/0001_initial.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.db import migrations, models +import django.db.models.deletion class Migration(migrations.Migration): @@ -14,7 +15,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='EmbedDirectionsPlugin', fields=[ - ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), + ('cmsplugin_ptr', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), ('query', models.CharField(help_text='defines the place to highlight on the map. It accepts a location as either a place name or address', max_length=255, verbose_name='Query')), ('map_type', models.CharField(default=b'roadmap', max_length=300, verbose_name='Map Type', choices=[(b'roadmap', 'Roadmap'), (b'satellite', 'Satellite')])), ('center', models.CharField(help_text='optionally define the center of the map view. It accepts a comma-separated latitude and longitude value (such as 37.4218,-122.0840).', max_length=255, null=True, verbose_name='Center of the map (latitude + longitude)', blank=True)), @@ -38,7 +39,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='EmbedPlacePlugin', fields=[ - ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), + ('cmsplugin_ptr', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), ('query', models.CharField(help_text='defines the place to highlight on the map. It accepts a location as either a place name or address', max_length=255, verbose_name='Query')), ('map_type', models.CharField(default=b'roadmap', max_length=300, verbose_name='Map Type', choices=[(b'roadmap', 'Roadmap'), (b'satellite', 'Satellite')])), ('center', models.CharField(help_text='optionally define the center of the map view. It accepts a comma-separated latitude and longitude value (such as 37.4218,-122.0840).', max_length=255, null=True, verbose_name='Center of the map (latitude + longitude)', blank=True)), @@ -56,7 +57,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='EmbedSearchPlugin', fields=[ - ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), + ('cmsplugin_ptr', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), ('query', models.CharField(help_text='defines the place to highlight on the map. It accepts a location as either a place name or address', max_length=255, verbose_name='Query')), ('map_type', models.CharField(default=b'roadmap', max_length=300, verbose_name='Map Type', choices=[(b'roadmap', 'Roadmap'), (b'satellite', 'Satellite')])), ('center', models.CharField(help_text='optionally define the center of the map view. It accepts a comma-separated latitude and longitude value (such as 37.4218,-122.0840).', max_length=255, null=True, verbose_name='Center of the map (latitude + longitude)', blank=True)), @@ -74,7 +75,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='EmbedViewPlugin', fields=[ - ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), + ('cmsplugin_ptr', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), ('query', models.CharField(help_text='defines the place to highlight on the map. It accepts a location as either a place name or address', max_length=255, verbose_name='Query')), ('map_type', models.CharField(default=b'roadmap', max_length=300, verbose_name='Map Type', choices=[(b'roadmap', 'Roadmap'), (b'satellite', 'Satellite')])), ('center', models.CharField(help_text='optionally define the center of the map view. It accepts a comma-separated latitude and longitude value (such as 37.4218,-122.0840).', max_length=255, null=True, verbose_name='Center of the map (latitude + longitude)', blank=True)), @@ -92,7 +93,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='LocationPlugin', fields=[ - ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), + ('cmsplugin_ptr', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), ('address', models.CharField(max_length=150, verbose_name='address')), ('zipcode', models.CharField(max_length=30, verbose_name='zip code')), ('city', models.CharField(max_length=100, verbose_name='city')), @@ -108,7 +109,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='MapPlugin', fields=[ - ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), + ('cmsplugin_ptr', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), ('title', models.CharField(max_length=100, null=True, verbose_name='map title', blank=True)), ('zoom', models.CharField(choices=[(b'0', b'0'), (b'1', b'1'), (b'2', b'2'), (b'3', b'3'), (b'4', b'4'), (b'5', b'5'), (b'6', b'6'), (b'7', b'7'), (b'8', b'8'), (b'9', b'9'), (b'10', b'10'), (b'11', b'11'), (b'12', b'12'), (b'13', b'13'), (b'14', b'14'), (b'15', b'15'), (b'16', b'16'), (b'17', b'17'), (b'18', b'18'), (b'19', b'19'), (b'20', b'20'), (b'21', b'21')], max_length=20, blank=True, help_text='Leave empty for auto zoom', null=True, verbose_name='Zoom level')), ('route_planner_title', models.CharField(default='Calculate your fastest way to here', max_length=150, null=True, verbose_name='Route Planner Title', blank=True)), @@ -131,7 +132,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='RouteLocationPlugin', fields=[ - ('locationplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='aldryn_locations.LocationPlugin')), + ('locationplugin_ptr', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, auto_created=True, primary_key=True, serialize=False, to='aldryn_locations.LocationPlugin')), ], options={ 'abstract': False, diff --git a/aldryn_locations/migrations/0003_path file location.py b/aldryn_locations/migrations/0003_path file location.py index 38244ec..8aaa0d6 100644 --- a/aldryn_locations/migrations/0003_path file location.py +++ b/aldryn_locations/migrations/0003_path file location.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.db import migrations, models +import django.db.models.deletion import filer.fields.file @@ -17,7 +18,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='PathLocationPlugin', fields=[ - ('cmsplugin_ptr', models.OneToOneField(parent_link=True, related_name='aldryn_locations_pathlocationplugin', auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), + ('cmsplugin_ptr', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, related_name='aldryn_locations_pathlocationplugin', auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), ('path_file', filer.fields.file.FilerFileField(related_name='+', verbose_name='Path File (e.g. KML)', to='filer.File')), ], options={ diff --git a/aldryn_locations/migrations/0004_auto_20160914_1511.py b/aldryn_locations/migrations/0004_auto_20160914_1511.py index 37b368e..ad7a56e 100644 --- a/aldryn_locations/migrations/0004_auto_20160914_1511.py +++ b/aldryn_locations/migrations/0004_auto_20160914_1511.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.db import migrations, models +import django.db.models.deletion class Migration(migrations.Migration): @@ -14,36 +15,36 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='embeddirectionsplugin', name='cmsplugin_ptr', - field=models.OneToOneField(parent_link=True, related_name='aldryn_locations_embeddirectionsplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'), + field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, related_name='aldryn_locations_embeddirectionsplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'), ), migrations.AlterField( model_name='embedplaceplugin', name='cmsplugin_ptr', - field=models.OneToOneField(parent_link=True, related_name='aldryn_locations_embedplaceplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'), + field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, related_name='aldryn_locations_embedplaceplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'), ), migrations.AlterField( model_name='embedsearchplugin', name='cmsplugin_ptr', - field=models.OneToOneField(parent_link=True, related_name='aldryn_locations_embedsearchplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'), + field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, related_name='aldryn_locations_embedsearchplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'), ), migrations.AlterField( model_name='embedviewplugin', name='cmsplugin_ptr', - field=models.OneToOneField(parent_link=True, related_name='aldryn_locations_embedviewplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'), + field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, related_name='aldryn_locations_embedviewplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'), ), migrations.AlterField( model_name='locationplugin', name='cmsplugin_ptr', - field=models.OneToOneField(parent_link=True, related_name='aldryn_locations_locationplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'), + field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, related_name='aldryn_locations_locationplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'), ), migrations.AlterField( model_name='mapplugin', name='cmsplugin_ptr', - field=models.OneToOneField(parent_link=True, related_name='aldryn_locations_mapplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'), + field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, related_name='aldryn_locations_mapplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'), ), migrations.AlterField( model_name='pathlocationplugin', name='cmsplugin_ptr', - field=models.OneToOneField(parent_link=True, related_name='aldryn_locations_pathlocationplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'), + field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, related_name='aldryn_locations_pathlocationplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'), ), ] diff --git a/aldryn_locations/models.py b/aldryn_locations/models.py index d19e2fd..f89f277 100644 --- a/aldryn_locations/models.py +++ b/aldryn_locations/models.py @@ -43,6 +43,7 @@ class MapPlugin(CMSPlugin): CMSPlugin, related_name='%(app_label)s_%(class)s', parent_link=True, + on_delete=models.CASCADE, ) title = models.CharField(_("map title"), max_length=255, blank=True, @@ -165,6 +166,7 @@ class LocationPlugin(CMSPlugin): CMSPlugin, related_name='%(app_label)s_%(class)s', parent_link=True, + on_delete=models.CASCADE, ) address = models.CharField(_("address"), max_length=255) @@ -228,6 +230,7 @@ class PathLocationPlugin(CMSPlugin): CMSPlugin, related_name='%(app_label)s_%(class)s', parent_link=True, + on_delete=models.CASCADE, ) path_file = FilerFileField( @@ -257,6 +260,7 @@ class EmbedPlugin(CMSPlugin): CMSPlugin, related_name='%(app_label)s_%(class)s', parent_link=True, + on_delete=models.CASCADE, ) query = models.CharField(