diff --git a/sandbox/sandbox/apps/home/migrations/0001_initial.py b/sandbox/sandbox/apps/home/migrations/0001_initial.py index c71c7d2..146ab62 100644 --- a/sandbox/sandbox/apps/home/migrations/0001_initial.py +++ b/sandbox/sandbox/apps/home/migrations/0001_initial.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.11.1 on 2017-05-31 10:20 +# Generated by Django 1.11.1 on 2017-05-31 16:07 from __future__ import unicode_literals from django.db import migrations, models @@ -11,7 +11,8 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('wagtail_personalisation', '0009_auto_20170531_0428'), + ('wagtail_personalisation', '0010_auto_20170531_1101'), + ('wagtailcore', '0033_remove_golive_expiry_help_text'), ] operations = [ @@ -21,7 +22,7 @@ class Migration(migrations.Migration): ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')), ('is_segmented', models.BooleanField(default=False)), ('canonical_page', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='variations', to='home.HomePage')), - ('segment', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='segments', to='wagtail_personalisation.Segment')), + ('segment', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtail_personalisation.Segment')), ], options={ 'abstract': False, diff --git a/sandbox/sandbox/apps/home/migrations/0002_create_homepage.py b/sandbox/sandbox/apps/home/migrations/0002_create_homepage.py deleted file mode 100644 index 1fdd867..0000000 --- a/sandbox/sandbox/apps/home/migrations/0002_create_homepage.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations - - -def create_homepage(apps, schema_editor): - # Get models - ContentType = apps.get_model('contenttypes.ContentType') - Page = apps.get_model('wagtailcore.Page') - Site = apps.get_model('wagtailcore.Site') - HomePage = apps.get_model('home.HomePage') - - # Delete the default homepage - # If migration is run multiple times, it may have already been deleted - Page.objects.filter(id=2).delete() - - # Create content type for homepage model - homepage_content_type, __ = ContentType.objects.get_or_create( - model='homepage', app_label='home') - - # Create a new homepage - homepage = HomePage.objects.create( - title="Home", - slug='home', - content_type=homepage_content_type, - path='00010001', - depth=2, - numchild=0, - url_path='/home/', - ) - - # Create a site with the new homepage set as the root - Site.objects.create( - hostname='localhost', root_page=homepage, is_default_site=True) - - -def remove_homepage(apps, schema_editor): - # Get models - ContentType = apps.get_model('contenttypes.ContentType') - HomePage = apps.get_model('home.HomePage') - - # Delete the default homepage - # Page and Site objects CASCADE - HomePage.objects.filter(slug='home', depth=2).delete() - - # Delete content type for homepage model - ContentType.objects.filter(model='homepage', app_label='home').delete() - - -class Migration(migrations.Migration): - - dependencies = [ - ('home', '0001_initial'), - ] - - operations = [ - migrations.RunPython(create_homepage, remove_homepage), - ] diff --git a/sandbox/sandbox/apps/user/migrations/0001_initial.py b/sandbox/sandbox/apps/user/migrations/0001_initial.py index a39c715..9fdab0c 100644 --- a/sandbox/sandbox/apps/user/migrations/0001_initial.py +++ b/sandbox/sandbox/apps/user/migrations/0001_initial.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.11.1 on 2017-05-31 12:22 +# Generated by Django 1.11.1 on 2017-05-31 16:07 from __future__ import unicode_literals import django.contrib.auth.models