Skip to content
This repository was archived by the owner on Feb 1, 2019. It is now read-only.

Commit 4557381

Browse files
committed
Add 'on_delete=models.CASCADE'
1 parent a0df60c commit 4557381

File tree

5 files changed

+23
-15
lines changed

5 files changed

+23
-15
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CHANGELOG
77
* Fix unicode error in python 3
88
* Fix for 'query' field not used in model for Django 1.11
99
* Fix leaking the admin url when accessed without login
10+
* Add 'on_delete=models.CASCADE' required for Django 2.0
1011

1112

1213
1.1.3 (2016-10-11)

aldryn_locations/migrations/0001_initial.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from __future__ import unicode_literals
33

44
from django.db import migrations, models
5+
import django.db.models.deletion
56

67

78
class Migration(migrations.Migration):
@@ -14,7 +15,7 @@ class Migration(migrations.Migration):
1415
migrations.CreateModel(
1516
name='EmbedDirectionsPlugin',
1617
fields=[
17-
('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')),
18+
('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')),
1819
('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')),
1920
('map_type', models.CharField(default=b'roadmap', max_length=300, verbose_name='Map Type', choices=[(b'roadmap', 'Roadmap'), (b'satellite', 'Satellite')])),
2021
('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):
3839
migrations.CreateModel(
3940
name='EmbedPlacePlugin',
4041
fields=[
41-
('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')),
42+
('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')),
4243
('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')),
4344
('map_type', models.CharField(default=b'roadmap', max_length=300, verbose_name='Map Type', choices=[(b'roadmap', 'Roadmap'), (b'satellite', 'Satellite')])),
4445
('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):
5657
migrations.CreateModel(
5758
name='EmbedSearchPlugin',
5859
fields=[
59-
('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')),
60+
('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')),
6061
('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')),
6162
('map_type', models.CharField(default=b'roadmap', max_length=300, verbose_name='Map Type', choices=[(b'roadmap', 'Roadmap'), (b'satellite', 'Satellite')])),
6263
('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):
7475
migrations.CreateModel(
7576
name='EmbedViewPlugin',
7677
fields=[
77-
('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')),
78+
('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')),
7879
('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')),
7980
('map_type', models.CharField(default=b'roadmap', max_length=300, verbose_name='Map Type', choices=[(b'roadmap', 'Roadmap'), (b'satellite', 'Satellite')])),
8081
('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):
9293
migrations.CreateModel(
9394
name='LocationPlugin',
9495
fields=[
95-
('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')),
96+
('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')),
9697
('address', models.CharField(max_length=150, verbose_name='address')),
9798
('zipcode', models.CharField(max_length=30, verbose_name='zip code')),
9899
('city', models.CharField(max_length=100, verbose_name='city')),
@@ -108,7 +109,7 @@ class Migration(migrations.Migration):
108109
migrations.CreateModel(
109110
name='MapPlugin',
110111
fields=[
111-
('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')),
112+
('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')),
112113
('title', models.CharField(max_length=100, null=True, verbose_name='map title', blank=True)),
113114
('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')),
114115
('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):
131132
migrations.CreateModel(
132133
name='RouteLocationPlugin',
133134
fields=[
134-
('locationplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='aldryn_locations.LocationPlugin')),
135+
('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')),
135136
],
136137
options={
137138
'abstract': False,

aldryn_locations/migrations/0003_path file location.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from __future__ import unicode_literals
33

44
from django.db import migrations, models
5+
import django.db.models.deletion
56
import filer.fields.file
67

78

@@ -17,7 +18,7 @@ class Migration(migrations.Migration):
1718
migrations.CreateModel(
1819
name='PathLocationPlugin',
1920
fields=[
20-
('cmsplugin_ptr', models.OneToOneField(parent_link=True, related_name='aldryn_locations_pathlocationplugin', auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')),
21+
('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')),
2122
('path_file', filer.fields.file.FilerFileField(related_name='+', verbose_name='Path File (e.g. KML)', to='filer.File')),
2223
],
2324
options={

aldryn_locations/migrations/0004_auto_20160914_1511.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from __future__ import unicode_literals
33

44
from django.db import migrations, models
5+
import django.db.models.deletion
56

67

78
class Migration(migrations.Migration):
@@ -14,36 +15,36 @@ class Migration(migrations.Migration):
1415
migrations.AlterField(
1516
model_name='embeddirectionsplugin',
1617
name='cmsplugin_ptr',
17-
field=models.OneToOneField(parent_link=True, related_name='aldryn_locations_embeddirectionsplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'),
18+
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'),
1819
),
1920
migrations.AlterField(
2021
model_name='embedplaceplugin',
2122
name='cmsplugin_ptr',
22-
field=models.OneToOneField(parent_link=True, related_name='aldryn_locations_embedplaceplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'),
23+
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'),
2324
),
2425
migrations.AlterField(
2526
model_name='embedsearchplugin',
2627
name='cmsplugin_ptr',
27-
field=models.OneToOneField(parent_link=True, related_name='aldryn_locations_embedsearchplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'),
28+
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'),
2829
),
2930
migrations.AlterField(
3031
model_name='embedviewplugin',
3132
name='cmsplugin_ptr',
32-
field=models.OneToOneField(parent_link=True, related_name='aldryn_locations_embedviewplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'),
33+
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'),
3334
),
3435
migrations.AlterField(
3536
model_name='locationplugin',
3637
name='cmsplugin_ptr',
37-
field=models.OneToOneField(parent_link=True, related_name='aldryn_locations_locationplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'),
38+
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'),
3839
),
3940
migrations.AlterField(
4041
model_name='mapplugin',
4142
name='cmsplugin_ptr',
42-
field=models.OneToOneField(parent_link=True, related_name='aldryn_locations_mapplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'),
43+
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'),
4344
),
4445
migrations.AlterField(
4546
model_name='pathlocationplugin',
4647
name='cmsplugin_ptr',
47-
field=models.OneToOneField(parent_link=True, related_name='aldryn_locations_pathlocationplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'),
48+
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'),
4849
),
4950
]

aldryn_locations/models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class MapPlugin(CMSPlugin):
4343
CMSPlugin,
4444
related_name='%(app_label)s_%(class)s',
4545
parent_link=True,
46+
on_delete=models.CASCADE,
4647
)
4748

4849
title = models.CharField(_("map title"), max_length=255, blank=True,
@@ -165,6 +166,7 @@ class LocationPlugin(CMSPlugin):
165166
CMSPlugin,
166167
related_name='%(app_label)s_%(class)s',
167168
parent_link=True,
169+
on_delete=models.CASCADE,
168170
)
169171

170172
address = models.CharField(_("address"), max_length=255)
@@ -228,6 +230,7 @@ class PathLocationPlugin(CMSPlugin):
228230
CMSPlugin,
229231
related_name='%(app_label)s_%(class)s',
230232
parent_link=True,
233+
on_delete=models.CASCADE,
231234
)
232235

233236
path_file = FilerFileField(
@@ -257,6 +260,7 @@ class EmbedPlugin(CMSPlugin):
257260
CMSPlugin,
258261
related_name='%(app_label)s_%(class)s',
259262
parent_link=True,
263+
on_delete=models.CASCADE,
260264
)
261265

262266
query = models.CharField(

0 commit comments

Comments
 (0)