From 55f4e71935255aa48ad332c008be2c5505ac646b Mon Sep 17 00:00:00 2001 From: Oleg Smedyuk Date: Thu, 23 May 2019 13:20:31 +0300 Subject: [PATCH 01/12] adjust migrations to support django 2 --- aldryn_locations/migrations/0001_initial.py | 60 +++++++++---------- .../migrations/0002_bump_max_lengths.py | 30 +++++----- .../migrations/0003_path file location.py | 4 +- .../migrations/0004_auto_20160914_1511.py | 14 ++--- .../migrations/0005_auto_20180507_1427.py | 23 +++++++ 5 files changed, 77 insertions(+), 54 deletions(-) create mode 100644 aldryn_locations/migrations/0005_auto_20180507_1427.py diff --git a/aldryn_locations/migrations/0001_initial.py b/aldryn_locations/migrations/0001_initial.py index 660d82e..c58b046 100644 --- a/aldryn_locations/migrations/0001_initial.py +++ b/aldryn_locations/migrations/0001_initial.py @@ -14,21 +14,21 @@ 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(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)), ('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')])), + ('map_type', models.CharField(default='roadmap', max_length=300, verbose_name='Map Type', choices=[('roadmap', 'Roadmap'), ('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)), - ('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=2, blank=True, help_text='0 (the whole world) to 21 (individual buildings). Leave empty for auto zoom', null=True, verbose_name='Zoom level')), + ('zoom', models.CharField(choices=[('0', '0'), ('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8'), ('9', '9'), ('10', '10'), ('11', '11'), ('12', '12'), ('13', '13'), ('14', '14'), ('15', '15'), ('16', '16'), ('17', '17'), ('18', '18'), ('19', '19'), ('20', '20'), ('21', '21')], max_length=2, blank=True, help_text='0 (the whole world) to 21 (individual buildings). Leave empty for auto zoom', null=True, verbose_name='Zoom level')), ('ui_lang', models.CharField(help_text='default to page language', max_length=10, null=True, verbose_name='language for ui elements', blank=True)), ('region', models.CharField(help_text=' defines the appropriate borders and labels to display, based on geo-political sensitivities. Accepts a region code specified as a two-character ccTLD (top-level domain) value.', max_length=10, null=True, verbose_name='map region (ccTLD)', blank=True)), - ('width', models.CharField(default=b'100%', help_text='Plugin width (in pixels or percent).', max_length=6, verbose_name='width')), - ('height', models.CharField(default=b'400px', help_text='Plugin height (in pixels).', max_length=6, verbose_name='height')), + ('width', models.CharField(default='100%', help_text='Plugin width (in pixels or percent).', max_length=6, verbose_name='width')), + ('height', models.CharField(default='400px', help_text='Plugin height (in pixels).', max_length=6, verbose_name='height')), ('origin', models.CharField(help_text='defines the origin and accepts a location as either a place name or address', max_length=255, verbose_name='origin')), ('destination', models.CharField(help_text='defines the destination and accepts a location as either a place name or address', max_length=255, verbose_name='destination')), ('waypoints', models.CharField(help_text='separated by the pipe character (|) (e.g. Berlin,Germany|Paris,France)', max_length=255, null=True, verbose_name='list of waypoints', blank=True)), - ('travel_mode', models.CharField(default=b'auto', max_length=50, verbose_name='travel mode', choices=[(b'auto', 'Automatic'), (b'driving', 'Driving'), (b'walking', 'Walking'), (b'bicycling', 'Bicycling'), (b'transit', 'Transit'), (b'flying', 'Flying')])), - ('avoid', models.CharField(blank=True, max_length=50, null=True, verbose_name='avoid certain means', choices=[(b'tolls', 'Tolls'), (b'highways', 'Highways'), (b'ferries', 'Ferries'), (b'tolls|highways', 'Tolls & Highways'), (b'tolls|ferries', 'Tolls & Ferries'), (b'ferries|highways', 'Ferries & Highways'), (b'tolls|ferries|highways', 'Tolls, Ferries & Highways')])), - ('units', models.CharField(default=b'auto', max_length=10, verbose_name='units for distances in results', choices=[(b'auto', 'Automatic'), (b'metric', 'Metric'), (b'imperial', 'Imperial')])), + ('travel_mode', models.CharField(default='auto', max_length=50, verbose_name='travel mode', choices=[('auto', 'Automatic'), ('driving', 'Driving'), ('walking', 'Walking'), ('bicycling', 'Bicycling'), ('transit', 'Transit'), ('flying', 'Flying')])), + ('avoid', models.CharField(blank=True, max_length=50, null=True, verbose_name='avoid certain means', choices=[('tolls', 'Tolls'), ('highways', 'Highways'), ('ferries', 'Ferries'), ('tolls|highways', 'Tolls & Highways'), ('tolls|ferries', 'Tolls & Ferries'), ('ferries|highways', 'Ferries & Highways'), ('tolls|ferries|highways', 'Tolls, Ferries & Highways')])), + ('units', models.CharField(default='auto', max_length=10, verbose_name='units for distances in results', choices=[('auto', 'Automatic'), ('metric', 'Metric'), ('imperial', 'Imperial')])), ], options={ 'abstract': False, @@ -38,15 +38,15 @@ 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(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)), ('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')])), + ('map_type', models.CharField(default='roadmap', max_length=300, verbose_name='Map Type', choices=[('roadmap', 'Roadmap'), ('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)), - ('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=2, blank=True, help_text='0 (the whole world) to 21 (individual buildings). Leave empty for auto zoom', null=True, verbose_name='Zoom level')), + ('zoom', models.CharField(choices=[('0', '0'), ('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8'), ('9', '9'), ('10', '10'), ('11', '11'), ('12', '12'), ('13', '13'), ('14', '14'), ('15', '15'), ('16', '16'), ('17', '17'), ('18', '18'), ('19', '19'), ('20', '20'), ('21', '21')], max_length=2, blank=True, help_text='0 (the whole world) to 21 (individual buildings). Leave empty for auto zoom', null=True, verbose_name='Zoom level')), ('ui_lang', models.CharField(help_text='default to page language', max_length=10, null=True, verbose_name='language for ui elements', blank=True)), ('region', models.CharField(help_text=' defines the appropriate borders and labels to display, based on geo-political sensitivities. Accepts a region code specified as a two-character ccTLD (top-level domain) value.', max_length=10, null=True, verbose_name='map region (ccTLD)', blank=True)), - ('width', models.CharField(default=b'100%', help_text='Plugin width (in pixels or percent).', max_length=6, verbose_name='width')), - ('height', models.CharField(default=b'400px', help_text='Plugin height (in pixels).', max_length=6, verbose_name='height')), + ('width', models.CharField(default='100%', help_text='Plugin width (in pixels or percent).', max_length=6, verbose_name='width')), + ('height', models.CharField(default='400px', help_text='Plugin height (in pixels).', max_length=6, verbose_name='height')), ], options={ 'abstract': False, @@ -56,15 +56,15 @@ 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(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)), ('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')])), + ('map_type', models.CharField(default='roadmap', max_length=300, verbose_name='Map Type', choices=[('roadmap', 'Roadmap'), ('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)), - ('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=2, blank=True, help_text='0 (the whole world) to 21 (individual buildings). Leave empty for auto zoom', null=True, verbose_name='Zoom level')), + ('zoom', models.CharField(choices=[('0', '0'), ('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8'), ('9', '9'), ('10', '10'), ('11', '11'), ('12', '12'), ('13', '13'), ('14', '14'), ('15', '15'), ('16', '16'), ('17', '17'), ('18', '18'), ('19', '19'), ('20', '20'), ('21', '21')], max_length=2, blank=True, help_text='0 (the whole world) to 21 (individual buildings). Leave empty for auto zoom', null=True, verbose_name='Zoom level')), ('ui_lang', models.CharField(help_text='default to page language', max_length=10, null=True, verbose_name='language for ui elements', blank=True)), ('region', models.CharField(help_text=' defines the appropriate borders and labels to display, based on geo-political sensitivities. Accepts a region code specified as a two-character ccTLD (top-level domain) value.', max_length=10, null=True, verbose_name='map region (ccTLD)', blank=True)), - ('width', models.CharField(default=b'100%', help_text='Plugin width (in pixels or percent).', max_length=6, verbose_name='width')), - ('height', models.CharField(default=b'400px', help_text='Plugin height (in pixels).', max_length=6, verbose_name='height')), + ('width', models.CharField(default='100%', help_text='Plugin width (in pixels or percent).', max_length=6, verbose_name='width')), + ('height', models.CharField(default='400px', help_text='Plugin height (in pixels).', max_length=6, verbose_name='height')), ], options={ 'abstract': False, @@ -74,15 +74,15 @@ 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(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)), ('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')])), + ('map_type', models.CharField(default='roadmap', max_length=300, verbose_name='Map Type', choices=[('roadmap', 'Roadmap'), ('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)), - ('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=2, blank=True, help_text='0 (the whole world) to 21 (individual buildings). Leave empty for auto zoom', null=True, verbose_name='Zoom level')), + ('zoom', models.CharField(choices=[('0', '0'), ('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8'), ('9', '9'), ('10', '10'), ('11', '11'), ('12', '12'), ('13', '13'), ('14', '14'), ('15', '15'), ('16', '16'), ('17', '17'), ('18', '18'), ('19', '19'), ('20', '20'), ('21', '21')], max_length=2, blank=True, help_text='0 (the whole world) to 21 (individual buildings). Leave empty for auto zoom', null=True, verbose_name='Zoom level')), ('ui_lang', models.CharField(help_text='default to page language', max_length=10, null=True, verbose_name='language for ui elements', blank=True)), ('region', models.CharField(help_text=' defines the appropriate borders and labels to display, based on geo-political sensitivities. Accepts a region code specified as a two-character ccTLD (top-level domain) value.', max_length=10, null=True, verbose_name='map region (ccTLD)', blank=True)), - ('width', models.CharField(default=b'100%', help_text='Plugin width (in pixels or percent).', max_length=6, verbose_name='width')), - ('height', models.CharField(default=b'400px', help_text='Plugin height (in pixels).', max_length=6, verbose_name='height')), + ('width', models.CharField(default='100%', help_text='Plugin width (in pixels or percent).', max_length=6, verbose_name='width')), + ('height', models.CharField(default='400px', help_text='Plugin height (in pixels).', max_length=6, verbose_name='height')), ], options={ 'abstract': False, @@ -92,7 +92,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(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)), ('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,12 +108,12 @@ 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(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)), ('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')), + ('zoom', models.CharField(choices=[('0', '0'), ('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8'), ('9', '9'), ('10', '10'), ('11', '11'), ('12', '12'), ('13', '13'), ('14', '14'), ('15', '15'), ('16', '16'), ('17', '17'), ('18', '18'), ('19', '19'), ('20', '20'), ('21', '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)), - ('width', models.CharField(default=b'100%', help_text='Plugin width (in pixels or percent).', max_length=6, verbose_name='width')), - ('height', models.CharField(default=b'400px', help_text='Plugin height (in pixels).', max_length=6, verbose_name='height')), + ('width', models.CharField(default='100%', help_text='Plugin width (in pixels or percent).', max_length=6, verbose_name='width')), + ('height', models.CharField(default='400px', help_text='Plugin height (in pixels).', max_length=6, verbose_name='height')), ('scrollwheel', models.BooleanField(default=True, verbose_name='Enable scrollwheel zooming on the map')), ('double_click_zoom', models.BooleanField(default=True, verbose_name='Enable double click to zoom')), ('draggable', models.BooleanField(default=True, verbose_name='Allow map dragging')), @@ -121,7 +121,7 @@ class Migration(migrations.Migration): ('pan_control', models.BooleanField(default=True, verbose_name='Show pan control')), ('zoom_control', models.BooleanField(default=True, verbose_name='Show zoom control')), ('street_view_control', models.BooleanField(default=True, verbose_name='Show Street View control')), - ('map_type', models.CharField(default=b'roadmap', max_length=300, verbose_name='Map Type', choices=[(b'roadmap', 'Roadmap'), (b'satellite', 'Satellite'), (b'hybrid', 'Hybrid'), (b'terrain', 'Terrain')])), + ('map_type', models.CharField(default='roadmap', max_length=300, verbose_name='Map Type', choices=[('roadmap', 'Roadmap'), ('satellite', 'Satellite'), ('hybrid', 'Hybrid'), ('terrain', 'Terrain')])), ], options={ 'abstract': False, @@ -131,7 +131,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(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='aldryn_locations.LocationPlugin', on_delete=models.CASCADE)), ], options={ 'abstract': False, diff --git a/aldryn_locations/migrations/0002_bump_max_lengths.py b/aldryn_locations/migrations/0002_bump_max_lengths.py index 3bdd899..ae228cb 100644 --- a/aldryn_locations/migrations/0002_bump_max_lengths.py +++ b/aldryn_locations/migrations/0002_bump_max_lengths.py @@ -14,62 +14,62 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='embeddirectionsplugin', name='height', - field=models.CharField(default=b'400px', help_text='Plugin height (in pixels).', max_length=255, verbose_name='height'), + field=models.CharField(default='400px', help_text='Plugin height (in pixels).', max_length=255, verbose_name='height'), ), migrations.AlterField( model_name='embeddirectionsplugin', name='map_type', - field=models.CharField(default=b'roadmap', max_length=255, verbose_name='Map Type', choices=[(b'roadmap', 'Roadmap'), (b'satellite', 'Satellite')]), + field=models.CharField(default='roadmap', max_length=255, verbose_name='Map Type', choices=[('roadmap', 'Roadmap'), ('satellite', 'Satellite')]), ), migrations.AlterField( model_name='embeddirectionsplugin', name='width', - field=models.CharField(default=b'100%', help_text='Plugin width (in pixels or percent).', max_length=255, verbose_name='width'), + field=models.CharField(default='100%', help_text='Plugin width (in pixels or percent).', max_length=255, verbose_name='width'), ), migrations.AlterField( model_name='embedplaceplugin', name='height', - field=models.CharField(default=b'400px', help_text='Plugin height (in pixels).', max_length=255, verbose_name='height'), + field=models.CharField(default='400px', help_text='Plugin height (in pixels).', max_length=255, verbose_name='height'), ), migrations.AlterField( model_name='embedplaceplugin', name='map_type', - field=models.CharField(default=b'roadmap', max_length=255, verbose_name='Map Type', choices=[(b'roadmap', 'Roadmap'), (b'satellite', 'Satellite')]), + field=models.CharField(default='roadmap', max_length=255, verbose_name='Map Type', choices=[('roadmap', 'Roadmap'), ('satellite', 'Satellite')]), ), migrations.AlterField( model_name='embedplaceplugin', name='width', - field=models.CharField(default=b'100%', help_text='Plugin width (in pixels or percent).', max_length=255, verbose_name='width'), + field=models.CharField(default='100%', help_text='Plugin width (in pixels or percent).', max_length=255, verbose_name='width'), ), migrations.AlterField( model_name='embedsearchplugin', name='height', - field=models.CharField(default=b'400px', help_text='Plugin height (in pixels).', max_length=255, verbose_name='height'), + field=models.CharField(default='400px', help_text='Plugin height (in pixels).', max_length=255, verbose_name='height'), ), migrations.AlterField( model_name='embedsearchplugin', name='map_type', - field=models.CharField(default=b'roadmap', max_length=255, verbose_name='Map Type', choices=[(b'roadmap', 'Roadmap'), (b'satellite', 'Satellite')]), + field=models.CharField(default='roadmap', max_length=255, verbose_name='Map Type', choices=[('roadmap', 'Roadmap'), ('satellite', 'Satellite')]), ), migrations.AlterField( model_name='embedsearchplugin', name='width', - field=models.CharField(default=b'100%', help_text='Plugin width (in pixels or percent).', max_length=255, verbose_name='width'), + field=models.CharField(default='100%', help_text='Plugin width (in pixels or percent).', max_length=255, verbose_name='width'), ), migrations.AlterField( model_name='embedviewplugin', name='height', - field=models.CharField(default=b'400px', help_text='Plugin height (in pixels).', max_length=255, verbose_name='height'), + field=models.CharField(default='400px', help_text='Plugin height (in pixels).', max_length=255, verbose_name='height'), ), migrations.AlterField( model_name='embedviewplugin', name='map_type', - field=models.CharField(default=b'roadmap', max_length=255, verbose_name='Map Type', choices=[(b'roadmap', 'Roadmap'), (b'satellite', 'Satellite')]), + field=models.CharField(default='roadmap', max_length=255, verbose_name='Map Type', choices=[('roadmap', 'Roadmap'), ('satellite', 'Satellite')]), ), migrations.AlterField( model_name='embedviewplugin', name='width', - field=models.CharField(default=b'100%', help_text='Plugin width (in pixels or percent).', max_length=255, verbose_name='width'), + field=models.CharField(default='100%', help_text='Plugin width (in pixels or percent).', max_length=255, verbose_name='width'), ), migrations.AlterField( model_name='locationplugin', @@ -89,12 +89,12 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='mapplugin', name='height', - field=models.CharField(default=b'400px', help_text='Plugin height (in pixels).', max_length=255, verbose_name='height'), + field=models.CharField(default='400px', help_text='Plugin height (in pixels).', max_length=255, verbose_name='height'), ), migrations.AlterField( model_name='mapplugin', name='map_type', - field=models.CharField(default=b'roadmap', max_length=255, verbose_name='Map Type', choices=[(b'roadmap', 'Roadmap'), (b'satellite', 'Satellite'), (b'hybrid', 'Hybrid'), (b'terrain', 'Terrain')]), + field=models.CharField(default='roadmap', max_length=255, verbose_name='Map Type', choices=[('roadmap', 'Roadmap'), ('satellite', 'Satellite'), ('hybrid', 'Hybrid'), ('terrain', 'Terrain')]), ), migrations.AlterField( model_name='mapplugin', @@ -109,6 +109,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='mapplugin', name='width', - field=models.CharField(default=b'100%', help_text='Plugin width (in pixels or percent).', max_length=255, verbose_name='width'), + field=models.CharField(default='100%', help_text='Plugin width (in pixels or percent).', max_length=255, verbose_name='width'), ), ] diff --git a/aldryn_locations/migrations/0003_path file location.py b/aldryn_locations/migrations/0003_path file location.py index 38244ec..2c9e8c0 100644 --- a/aldryn_locations/migrations/0003_path file location.py +++ b/aldryn_locations/migrations/0003_path file location.py @@ -17,8 +17,8 @@ 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')), - ('path_file', filer.fields.file.FilerFileField(related_name='+', verbose_name='Path File (e.g. KML)', to='filer.File')), + ('cmsplugin_ptr', models.OneToOneField(parent_link=True, related_name='aldryn_locations_pathlocationplugin', auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)), + ('path_file', filer.fields.file.FilerFileField(related_name='+', verbose_name='Path File (e.g. KML)', to='filer.File', on_delete=models.CASCADE)), ], options={ 'abstract': False, diff --git a/aldryn_locations/migrations/0004_auto_20160914_1511.py b/aldryn_locations/migrations/0004_auto_20160914_1511.py index 37b368e..1d90749 100644 --- a/aldryn_locations/migrations/0004_auto_20160914_1511.py +++ b/aldryn_locations/migrations/0004_auto_20160914_1511.py @@ -14,36 +14,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(parent_link=True, related_name='aldryn_locations_embeddirectionsplugin', primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE), ), 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(parent_link=True, related_name='aldryn_locations_embedplaceplugin', primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE), ), 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(parent_link=True, related_name='aldryn_locations_embedsearchplugin', primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE), ), 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(parent_link=True, related_name='aldryn_locations_embedviewplugin', primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE), ), 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(parent_link=True, related_name='aldryn_locations_locationplugin', primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE), ), 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(parent_link=True, related_name='aldryn_locations_mapplugin', primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE), ), 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(parent_link=True, related_name='aldryn_locations_pathlocationplugin', primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE), ), ] diff --git a/aldryn_locations/migrations/0005_auto_20180507_1427.py b/aldryn_locations/migrations/0005_auto_20180507_1427.py new file mode 100644 index 0000000..a00a15c --- /dev/null +++ b/aldryn_locations/migrations/0005_auto_20180507_1427.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11 on 2018-05-07 04:27 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('aldryn_locations', '0004_auto_20160914_1511'), + ] + + operations = [ + migrations.RemoveField( + model_name='embeddirectionsplugin', + name='query', + ), + migrations.RemoveField( + model_name='embedviewplugin', + name='query', + ), + ] From 1fe47ee5d16dbb032ffba789a79e2aabd47c532a Mon Sep 17 00:00:00 2001 From: Oleg Smedyuk Date: Thu, 23 May 2019 13:20:54 +0300 Subject: [PATCH 02/12] fix codebase for django2 support --- aldryn_locations/cms_plugins.py | 2 +- aldryn_locations/forms.py | 1 - aldryn_locations/models.py | 15 ++++++++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/aldryn_locations/cms_plugins.py b/aldryn_locations/cms_plugins.py index e5d3e4f..805b279 100644 --- a/aldryn_locations/cms_plugins.py +++ b/aldryn_locations/cms_plugins.py @@ -1,7 +1,7 @@ import json from django.utils.translation import ugettext_lazy as _ -from django.core.urlresolvers import reverse +from django.urls import reverse from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool diff --git a/aldryn_locations/forms.py b/aldryn_locations/forms.py index 7c7d44f..5958f1b 100644 --- a/aldryn_locations/forms.py +++ b/aldryn_locations/forms.py @@ -66,7 +66,6 @@ class EmbedViewPluginForm(ModelForm): class Meta: model = EmbedViewPlugin fields = [ - 'query', 'map_type', 'center', 'zoom', diff --git a/aldryn_locations/models.py b/aldryn_locations/models.py index 1ec7ac9..c044046 100644 --- a/aldryn_locations/models.py +++ b/aldryn_locations/models.py @@ -3,7 +3,7 @@ from django.template.defaultfilters import urlencode from django.utils.translation import ugettext_lazy as _ from django.conf import settings -from django.core.urlresolvers import reverse +from django.urls import reverse from cms.models import CMSPlugin, Site from cms.utils.i18n import get_current_language @@ -18,7 +18,7 @@ 'ALDRYN_LOCATIONS_GOOGLEMAPS_STATICMAPS_URL', 'https://maps.googleapis.com/maps/api/staticmap', ) -MARKER_CONTENT_FORMAT = unicode(settings.ALDRYN_LOCATIONS_MARKER_CONTENT_FORMAT) +MARKER_CONTENT_FORMAT = str(settings.ALDRYN_LOCATIONS_MARKER_CONTENT_FORMAT) ZOOM_LEVELS = [(str(level), str(level)) for level in range(22)] ROADMAP = 'roadmap' @@ -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,17 +230,19 @@ class PathLocationPlugin(CMSPlugin): CMSPlugin, related_name='%(app_label)s_%(class)s', parent_link=True, + on_delete=models.CASCADE ) path_file = FilerFileField( verbose_name=_('Path File (e.g. KML)'), related_name='+', + on_delete=models.CASCADE, ) def copy_relations(self, oldinstance): self.path_file = oldinstance.path_file - def __unicode__(self): + def __str__(self): if self.path_file: return self.path_file.name return self.pk @@ -257,6 +261,7 @@ class EmbedPlugin(CMSPlugin): CMSPlugin, related_name='%(app_label)s_%(class)s', parent_link=True, + on_delete=models.CASCADE, ) query = models.CharField( @@ -293,7 +298,7 @@ class EmbedPlugin(CMSPlugin): class Meta: abstract = True - def __unicode__(self): + def __str__(self): return self.query or self.center def get_query(self): @@ -410,7 +415,7 @@ class EmbedDirectionsPlugin(EmbedPlugin): units = models.CharField( _('units for distances in results'), max_length=10, default=AUTO[0], choices=[AUTO] + UNITS_CHOICES) - def __unicode__(self): + def __str__(self): ret = self.origin if self.waypoints: ret += ' -> %s' % ' -> '.join(self.waypoints.split('|')) From 866ed7caecc1a36a85dbb308a7b23fb61f368c4b Mon Sep 17 00:00:00 2001 From: Vladislav Yena Date: Wed, 4 Mar 2020 22:17:26 +0200 Subject: [PATCH 03/12] Fix Map plugin rendering issue --- aldryn_locations/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aldryn_locations/models.py b/aldryn_locations/models.py index c044046..a8b1dab 100644 --- a/aldryn_locations/models.py +++ b/aldryn_locations/models.py @@ -144,7 +144,7 @@ def clean_size(size): lat_lng = location.get_lat_lng() location = ( - ','.join(lat_lng) if lat_lng else + ','.join(map(str, lat_lng)) if lat_lng else ' '.join((location.address, location.zipcode, location.city)) ) query += '&markers={}'.format(urlencode(location)) From 8c72c470bf4ee0189d41f56f744abed632128246 Mon Sep 17 00:00:00 2001 From: Vladislav Yena Date: Thu, 26 Mar 2020 16:29:12 +0200 Subject: [PATCH 04/12] Fix the RouteLocationPlugin issue --- aldryn_locations/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aldryn_locations/models.py b/aldryn_locations/models.py index a8b1dab..b9801f6 100644 --- a/aldryn_locations/models.py +++ b/aldryn_locations/models.py @@ -222,6 +222,9 @@ def get_location_data_for_map(self): class RouteLocationPlugin(LocationPlugin): route_planner = True + class Meta: + proxy = True + class PathLocationPlugin(CMSPlugin): route_planner = False From 741ae7ff95f0230932fb6fc20dbfd9c81f4a221e Mon Sep 17 00:00:00 2001 From: Vladislav Yena Date: Wed, 24 Jun 2020 14:00:31 +0300 Subject: [PATCH 05/12] Add migration to fix broken RouteLocation plugins --- .../0006_fix_broken_routelocation_plugin.py | 121 ++++++++++++++++++ aldryn_locations/models.py | 59 ++++++++- 2 files changed, 177 insertions(+), 3 deletions(-) create mode 100644 aldryn_locations/migrations/0006_fix_broken_routelocation_plugin.py diff --git a/aldryn_locations/migrations/0006_fix_broken_routelocation_plugin.py b/aldryn_locations/migrations/0006_fix_broken_routelocation_plugin.py new file mode 100644 index 0000000..c0bd7b9 --- /dev/null +++ b/aldryn_locations/migrations/0006_fix_broken_routelocation_plugin.py @@ -0,0 +1,121 @@ +# Generated by Django 2.2.9 on 2020-06-23 18:56 +import django.db.models.deletion +from cms import api +from cms.models import CMSPlugin +from cms.models import Placeholder +from django.db import migrations +from django.db import models + + +def transfer_route_location_plugin_data(apps, schema_editor): + + RouteLocationPluginTemp = apps.get_model('aldryn_locations', 'RouteLocationPluginTemp') + + for temp_plugin in RouteLocationPluginTemp.objects.all(): + old_plugin = CMSPlugin.objects.get(pk=temp_plugin.pk) + placeholder_with_old_plugin = Placeholder.objects.get(pk=old_plugin.placeholder.pk) + page_with_old_plugin = placeholder_with_old_plugin.page + + if _is_page_published(page_with_old_plugin): + draft_page = page_with_old_plugin.get_draft_object() + draft_placeholder = draft_page.placeholders.get(slot=placeholder_with_old_plugin.slot) + draft_plugins = draft_placeholder.get_plugins() + draft_parent_map_plugins = list( + filter( + lambda x: ( + x.get_bound_plugin().plugin_type == old_plugin.parent.get_bound_plugin().plugin_type and + x.get_bound_plugin().title == old_plugin.parent.get_bound_plugin().title and + _is_numchild_value_broken(x) + ), + draft_plugins + ) + ) + + if draft_parent_map_plugins: + # For now we'll take the first available MapPlugin in the placeholder + draft_parent_map_plugin = draft_parent_map_plugins[0] + + # Fix the broken numchild field's value + draft_parent_map_plugin.numchild = draft_parent_map_plugin.get_children().count() + draft_parent_map_plugin.save() + + api.add_plugin( + placeholder=draft_placeholder, + language=temp_plugin.language, + target=draft_parent_map_plugin, + address=temp_plugin.address, + zipcode=temp_plugin.zipcode, + city=temp_plugin.city, + content=temp_plugin.content, + depth=temp_plugin.depth, + plugin_type=temp_plugin.plugin_type, + creation_date=temp_plugin.creation_date, + changed_date=temp_plugin.changed_date, + lat=temp_plugin.lat, + lng=temp_plugin.lng, + ) + else: + print( + "Failed to find the needed Map plugin on the Draft version of Page. " + "Most probably it doesn't exist anymore." + ) + + api.add_plugin( + placeholder=placeholder_with_old_plugin, + language=temp_plugin.language, + target=old_plugin.parent, + address=temp_plugin.address, + zipcode=temp_plugin.zipcode, + city=temp_plugin.city, + content=temp_plugin.content, + depth=temp_plugin.depth, + plugin_type=temp_plugin.plugin_type, + creation_date=temp_plugin.creation_date, + changed_date=temp_plugin.changed_date, + lat=temp_plugin.lat, + lng=temp_plugin.lng, + ) + + +def _is_numchild_value_broken(plugin): + # The 'numchild' value of broken plugins is greater than actual count of child plugins + return plugin.numchild > plugin.get_children().count() + + +def _is_page_published(page): + return not page.publisher_is_draft + + +class Migration(migrations.Migration): + + dependencies = [ + ('cms', '0022_auto_20180620_1551'), + ('aldryn_locations', '0005_auto_20180507_1427'), + ] + + operations = [ + migrations.RenameModel( + old_name='RouteLocationPlugin', + new_name='RouteLocationPluginTemp', + ), + migrations.CreateModel( + name='RouteLocationPlugin', + fields=[ + ('cmsplugin_ptr', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='aldryn_locations_routelocationplugin', serialize=False, to='cms.CMSPlugin')), + ('address', models.CharField(max_length=255, verbose_name='address')), + ('zipcode', models.CharField(max_length=30, verbose_name='zip code')), + ('city', models.CharField(max_length=255, verbose_name='city')), + ('content', models.CharField(blank=True, help_text='Displayed in a info window above location marker', max_length=255, verbose_name='Content')), + ('lat', models.FloatField(blank=True, help_text='Use latitude & longitude to fine tune the map position.', null=True, verbose_name='latitude')), + ('lng', models.FloatField(blank=True, null=True, verbose_name='longitude')), + ], + options={ + 'abstract': False, + }, + bases=('cms.cmsplugin',), + ), + migrations.RunPython(transfer_route_location_plugin_data), + migrations.DeleteModel( + name='RouteLocationPluginTemp', + ), + ] diff --git a/aldryn_locations/models.py b/aldryn_locations/models.py index b9801f6..f32e93b 100644 --- a/aldryn_locations/models.py +++ b/aldryn_locations/models.py @@ -219,11 +219,64 @@ def get_location_data_for_map(self): } -class RouteLocationPlugin(LocationPlugin): +class RouteLocationPlugin(CMSPlugin): route_planner = True - class Meta: - proxy = True + cmsplugin_ptr = models.OneToOneField( + CMSPlugin, + related_name='%(app_label)s_%(class)s', + parent_link=True, + on_delete=models.CASCADE, + ) + + address = models.CharField(_("address"), max_length=255) + zipcode = models.CharField(_("zip code"), max_length=30) + city = models.CharField(_("city"), max_length=255) + + content = models.CharField( + _('Content'), max_length=255, blank=True, + help_text=_('Displayed in a info window above location marker') + ) + + lat = models.FloatField( + _('latitude'), null=True, blank=True, + help_text=_('Use latitude & longitude to fine tune the map position.')) + + lng = models.FloatField( + _('longitude'), null=True, blank=True) + + def __str__(self): + return u'%s, %s %s' % (self.address, self.zipcode, self.city) + + def get_content(self): + if not self.content: + return None + + fmt = MARKER_CONTENT_FORMAT + + if not fmt: + return self.content + + return fmt.format( + content=self.content, + address=self.address, + zipcode=self.zipcode, + city=self.city, + lat=self.lat, + lng=self.lng, + ) + + def get_lat_lng(self): + if self.lat and self.lng: + return self.lat, self.lng + + def get_location_data_for_map(self): + return { + 'address': u'{}, {} {}'.format(self.address, self.zipcode, self.city), + 'latlng': self.get_lat_lng(), + 'content': self.get_content(), + 'admin': reverse('admin:cms_page_edit_plugin', args=[self.pk]), + } class PathLocationPlugin(CMSPlugin): From 38db958e4029a78ddebe03136eaa06249c5886c7 Mon Sep 17 00:00:00 2001 From: Peter Wischer Date: Mon, 29 Apr 2019 16:13:30 +0200 Subject: [PATCH 06/12] do not leak admin urls --- CHANGELOG.rst | 15 +++++++++++---- aldryn_locations/cms_plugins.py | 6 ++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 940f597..034ba52 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,24 +1,31 @@ CHANGELOG ========= +1.1.4 (2019-04-29) +------------------ + +* 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 + 1.1.3 (2016-10-11) ------------------ -* fix unicode error in location plugin -* fix error introduced in 1.1.2 (commit f76dedd7) +* Fix unicode error in location plugin +* Fix error introduced in 1.1.2 (commit f76dedd7) 1.1.2 (2016-10-11) ------------------ -* path location plugin: fix absolute url +* Path location plugin: fix absolute url 1.1.1 (2016-09-14) ------------------ -* fix staticmap with new kml location plugin +* Fix staticmap with new kml location plugin 1.1.0 (2016-09-14) diff --git a/aldryn_locations/cms_plugins.py b/aldryn_locations/cms_plugins.py index 805b279..157114a 100644 --- a/aldryn_locations/cms_plugins.py +++ b/aldryn_locations/cms_plugins.py @@ -56,6 +56,12 @@ def render(self, context, instance, placeholder): data = '{}{}'.format(base_url, data) path_sources.append(data) else: + if not request.toolbar or not ( + getattr(request.toolbar, 'edit_mode') + or getattr(request.toolbar, 'edit_mode_active') + ): + # do not leak /admin urls + data['admin'] = None location_data.append(data) # Options for the map comes from plugin so I assigned it here From cbf30ced57ed0f2e65dade80d2bbb3aed5bdd3c9 Mon Sep 17 00:00:00 2001 From: Peter Wischer Date: Mon, 29 Apr 2019 16:32:10 +0200 Subject: [PATCH 07/12] Add 'on_delete=models.CASCADE' --- CHANGELOG.rst | 1 + aldryn_locations/migrations/0001_initial.py | 15 ++++++++------- .../migrations/0003_path file location.py | 5 +++-- .../migrations/0004_auto_20160914_1511.py | 15 ++++++++------- aldryn_locations/models.py | 2 +- 5 files changed, 21 insertions(+), 17 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 c58b046..bd52bb9 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', on_delete=models.CASCADE)), + ('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='roadmap', max_length=300, verbose_name='Map Type', choices=[('roadmap', 'Roadmap'), ('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', on_delete=models.CASCADE)), + ('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='roadmap', max_length=300, verbose_name='Map Type', choices=[('roadmap', 'Roadmap'), ('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', on_delete=models.CASCADE)), + ('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='roadmap', max_length=300, verbose_name='Map Type', choices=[('roadmap', 'Roadmap'), ('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', on_delete=models.CASCADE)), + ('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='roadmap', max_length=300, verbose_name='Map Type', choices=[('roadmap', 'Roadmap'), ('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', on_delete=models.CASCADE)), + ('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', on_delete=models.CASCADE)), + ('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=[('0', '0'), ('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8'), ('9', '9'), ('10', '10'), ('11', '11'), ('12', '12'), ('13', '13'), ('14', '14'), ('15', '15'), ('16', '16'), ('17', '17'), ('18', '18'), ('19', '19'), ('20', '20'), ('21', '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', on_delete=models.CASCADE)), + ('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 2c9e8c0..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,8 +18,8 @@ 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', on_delete=models.CASCADE)), - ('path_file', filer.fields.file.FilerFileField(related_name='+', verbose_name='Path File (e.g. KML)', to='filer.File', on_delete=models.CASCADE)), + ('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={ 'abstract': False, diff --git a/aldryn_locations/migrations/0004_auto_20160914_1511.py b/aldryn_locations/migrations/0004_auto_20160914_1511.py index 1d90749..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', on_delete=models.CASCADE), + 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', on_delete=models.CASCADE), + 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', on_delete=models.CASCADE), + 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', on_delete=models.CASCADE), + 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', on_delete=models.CASCADE), + 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', on_delete=models.CASCADE), + 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', on_delete=models.CASCADE), + 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 f32e93b..dcf7c09 100644 --- a/aldryn_locations/models.py +++ b/aldryn_locations/models.py @@ -286,7 +286,7 @@ class PathLocationPlugin(CMSPlugin): CMSPlugin, related_name='%(app_label)s_%(class)s', parent_link=True, - on_delete=models.CASCADE + on_delete=models.CASCADE, ) path_file = FilerFileField( From 69ba75983ac0a12d875d66c66f77eca7c83374a7 Mon Sep 17 00:00:00 2001 From: Peter Wischer Date: Mon, 29 Apr 2019 16:33:18 +0200 Subject: [PATCH 08/12] release 1.1.4 (faked) --- aldryn_locations/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aldryn_locations/__init__.py b/aldryn_locations/__init__.py index 7bb021e..bc50bee 100644 --- a/aldryn_locations/__init__.py +++ b/aldryn_locations/__init__.py @@ -1 +1 @@ -__version__ = '1.1.3' +__version__ = '1.1.4' From af10e5711518f61e9d47fd7eba53d3855c3b3e78 Mon Sep 17 00:00:00 2001 From: Peter Wischer Date: Tue, 7 Jul 2020 12:10:06 +0200 Subject: [PATCH 09/12] use six directly `cms.utils.compat.dj` is no longer avaiable --- aldryn_locations/models.py | 2 +- setup.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/aldryn_locations/models.py b/aldryn_locations/models.py index dcf7c09..1d33db5 100644 --- a/aldryn_locations/models.py +++ b/aldryn_locations/models.py @@ -7,7 +7,7 @@ from cms.models import CMSPlugin, Site from cms.utils.i18n import get_current_language -from cms.utils.compat.dj import python_2_unicode_compatible +from six import python_2_unicode_compatible from filer.fields.file import FilerFileField diff --git a/setup.py b/setup.py index 527c077..b718808 100644 --- a/setup.py +++ b/setup.py @@ -6,6 +6,7 @@ REQUIREMENTS = [ 'aldryn-boilerplates>=0.6', 'django-filer', + 'six', ] CLASSIFIERS = [ From 4d1c0eff01e50e4c1d34aee8df07ef79dd56967d Mon Sep 17 00:00:00 2001 From: Peter Wischer Date: Tue, 7 Jul 2020 12:10:35 +0200 Subject: [PATCH 10/12] release 1.1.5 (faked) --- aldryn_locations/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aldryn_locations/__init__.py b/aldryn_locations/__init__.py index bc50bee..99d2a6f 100644 --- a/aldryn_locations/__init__.py +++ b/aldryn_locations/__init__.py @@ -1 +1 @@ -__version__ = '1.1.4' +__version__ = '1.1.5' From 6595345417d046ef9900796f515a94ae4ef303c1 Mon Sep 17 00:00:00 2001 From: Peter Wischer Date: Wed, 8 Jul 2020 12:24:38 +0200 Subject: [PATCH 11/12] add `on_delete` to migration --- aldryn_locations/migrations/0003_path file location.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aldryn_locations/migrations/0003_path file location.py b/aldryn_locations/migrations/0003_path file location.py index 8aaa0d6..faa7b83 100644 --- a/aldryn_locations/migrations/0003_path file location.py +++ b/aldryn_locations/migrations/0003_path file location.py @@ -19,7 +19,7 @@ class Migration(migrations.Migration): name='PathLocationPlugin', fields=[ ('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')), + ('path_file', filer.fields.file.FilerFileField(on_delete=django.db.models.deletion.CASCADE, related_name='+', verbose_name='Path File (e.g. KML)', to='filer.File')), ], options={ 'abstract': False, From 8f44a040eed89a9bc6dfccc8994a755308a692c8 Mon Sep 17 00:00:00 2001 From: Peter Wischer Date: Wed, 15 Jul 2020 11:23:56 +0200 Subject: [PATCH 12/12] update changelog --- CHANGELOG.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 639a194..cf5b33c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,19 @@ CHANGELOG ========= +1.1.6 (unreleased) +------------------ + +* TODO + + +1.1.5 (2019-07-08) +------------------ + +* Fix missing 'on_delete' in migrations +* Fix import of 'six' + + 1.1.4 (2019-04-29) ------------------