diff --git a/tests/testapp/migrations/0001_initial.py b/tests/testapp/migrations/0001_initial.py index 28e89d7..1f24c1f 100644 --- a/tests/testapp/migrations/0001_initial.py +++ b/tests/testapp/migrations/0001_initial.py @@ -1,17 +1,22 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10.4 on 2016-12-08 13:58 -from __future__ import unicode_literals +# Generated by Django 4.0.10 on 2023-05-16 05:53 import django.db.models.deletion +import wagtail.blocks +import wagtail.documents.blocks +import wagtail.fields +import wagtail.images.blocks from django.db import migrations, models -from wagtail import blocks, fields + +import tests.testapp.models class Migration(migrations.Migration): initial = True - dependencies = [("wagtailcore", "0030_index_on_pagerevision_created_at")] + dependencies = [ + ("wagtailcore", "0030_index_on_pagerevision_created_at"), + ] operations = [ migrations.CreateModel( @@ -25,17 +30,434 @@ class Migration(migrations.Migration): parent_link=True, primary_key=True, serialize=False, - to="wagtailcore.Page", + to="wagtailcore.page", + ), + ), + ( + "body", + wagtail.fields.StreamField( + [ + ( + "char_array", + wagtail.blocks.ListBlock(wagtail.blocks.CharBlock()), + ), + ( + "int_array", + wagtail.blocks.ListBlock(wagtail.blocks.IntegerBlock()), + ), + ( + "struct", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(max_length=100), + ), + ( + "item", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock(), + ), + ( + "value", + wagtail.blocks.IntegerBlock(), + ), + ] + ), + ), + ( + "items", + wagtail.blocks.ListBlock( + tests.testapp.models.MyBlockItem + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + required=False + ), + ), + ] + ), + ), + ("page", wagtail.blocks.PageChooserBlock()), + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock(), + ), + ], + use_json_field=True, + ), + ), + ], + options={ + "abstract": False, + }, + bases=("wagtailcore.page",), + ), + migrations.CreateModel( + name="PageWithNestedStreamBlock", + fields=[ + ( + "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", + ), + ), + ( + "body", + wagtail.fields.StreamField( + [ + ( + "inner_stream", + wagtail.blocks.StreamBlock( + [ + ( + "struct_block", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + max_length=100 + ), + ), + ( + "item", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock(), + ), + ( + "value", + wagtail.blocks.IntegerBlock(), + ), + ] + ), + ), + ( + "items", + wagtail.blocks.ListBlock( + tests.testapp.models.MyBlockItem + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + required=False + ), + ), + ] + ), + ), + ("char_block", wagtail.blocks.CharBlock()), + ] + ), + ) + ], + use_json_field=True, + ), + ), + ], + options={ + "abstract": False, + }, + bases=("wagtailcore.page",), + ), + migrations.CreateModel( + name="PageWithSimpleStructBlockNested", + fields=[ + ( + "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", + ), + ), + ( + "body", + wagtail.fields.StreamField( + [ + ( + "inner_stream", + wagtail.blocks.StreamBlock( + [ + ( + "simple_struct_block", + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(), + ), + ( + "number", + wagtail.blocks.IntegerBlock(), + ), + ( + "boolean", + wagtail.blocks.BooleanBlock(), + ), + ] + ), + ) + ] + ), + ) + ], + use_json_field=True, + ), + ), + ], + options={ + "abstract": False, + }, + bases=("wagtailcore.page",), + ), + migrations.CreateModel( + name="PageWithStreamBlock", + fields=[ + ( + "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", + ), + ), + ( + "body", + wagtail.fields.StreamField( + [ + ( + "struct_block", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(max_length=100), + ), + ( + "item", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock(), + ), + ( + "value", + wagtail.blocks.IntegerBlock(), + ), + ] + ), + ), + ( + "items", + wagtail.blocks.ListBlock( + tests.testapp.models.MyBlockItem + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + required=False + ), + ), + ] + ), + ), + ("char_block", wagtail.blocks.CharBlock()), + ], + use_json_field=True, + ), + ), + ], + options={ + "abstract": False, + }, + bases=("wagtailcore.page",), + ), + migrations.CreateModel( + name="PageWithStreamBlockInListBlock", + fields=[ + ( + "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", + ), + ), + ( + "body", + wagtail.fields.StreamField( + [ + ( + "list_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StreamBlock( + [ + ( + "struct_block", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + max_length=100 + ), + ), + ( + "item", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock(), + ), + ( + "value", + wagtail.blocks.IntegerBlock(), + ), + ] + ), + ), + ( + "items", + wagtail.blocks.ListBlock( + tests.testapp.models.MyBlockItem + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + required=False + ), + ), + ] + ), + ), + ("char_block", wagtail.blocks.CharBlock()), + ] + ) + ), + ) + ], + use_json_field=True, + ), + ), + ], + options={ + "abstract": False, + }, + bases=("wagtailcore.page",), + ), + migrations.CreateModel( + name="PageWithStreamBlockInStructBlock", + fields=[ + ( + "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", ), ), ( "body", - fields.StreamField( - (("char_array", blocks.ListBlock(blocks.CharBlock())),) + wagtail.fields.StreamField( + [ + ( + "struct_block", + wagtail.blocks.StructBlock( + [ + ( + "inner_stream", + wagtail.blocks.StreamBlock( + [ + ( + "struct_block", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + max_length=100 + ), + ), + ( + "item", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock(), + ), + ( + "value", + wagtail.blocks.IntegerBlock(), + ), + ] + ), + ), + ( + "items", + wagtail.blocks.ListBlock( + tests.testapp.models.MyBlockItem + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + required=False + ), + ), + ] + ), + ), + ( + "char_block", + wagtail.blocks.CharBlock(), + ), + ] + ), + ) + ] + ), + ) + ], + use_json_field=True, ), ), ], - options={"abstract": False}, + options={ + "abstract": False, + }, bases=("wagtailcore.page",), - ) + ), ] diff --git a/tests/testapp/migrations/0002_pagewithnestedstreamblock_and_more.py b/tests/testapp/migrations/0002_pagewithnestedstreamblock_and_more.py deleted file mode 100644 index 1cda22c..0000000 --- a/tests/testapp/migrations/0002_pagewithnestedstreamblock_and_more.py +++ /dev/null @@ -1,405 +0,0 @@ -# Generated by Django 4.0.5 on 2022-07-06 09:36 - -import django.db.models.deletion -import wagtail.images.blocks as image_blocks -from django.db import migrations, models -from wagtail import blocks, fields - -import tests.testapp.models - - -class Migration(migrations.Migration): - - dependencies = [ - ("testapp", "0001_initial"), - ] - - operations = [ - migrations.CreateModel( - name="PageWithNestedStreamBlock", - fields=[ - ( - "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", - ), - ), - ( - "body", - fields.StreamField( - [ - ( - "inner_stream", - blocks.StreamBlock( - [ - ( - "struct_block", - blocks.StructBlock( - [ - ( - "title", - blocks.CharBlock( - max_length=100 - ), - ), - ( - "item", - blocks.StructBlock( - [ - ( - "label", - blocks.CharBlock(), - ), - ( - "value", - blocks.IntegerBlock(), - ), - ] - ), - ), - ( - "items", - blocks.ListBlock( - tests.testapp.models.MyBlockItem - ), - ), - ( - "image", - image_blocks.ImageChooserBlock(), - ), - ] - ), - ), - ("char_block", blocks.CharBlock()), - ] - ), - ) - ], - ), - ), - ], - options={ - "abstract": False, - }, - bases=("wagtailcore.page",), - ), - migrations.CreateModel( - name="PageWithSimpleStructBlockNested", - fields=[ - ( - "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", - ), - ), - ( - "body", - fields.StreamField( - [ - ( - "inner_stream", - blocks.StreamBlock( - [ - ( - "simple_struct_block", - blocks.StructBlock( - [ - ( - "text", - blocks.CharBlock(), - ), - ( - "number", - blocks.IntegerBlock(), - ), - ( - "boolean", - blocks.BooleanBlock(), - ), - ] - ), - ) - ] - ), - ) - ], - ), - ), - ], - options={ - "abstract": False, - }, - bases=("wagtailcore.page",), - ), - migrations.CreateModel( - name="PageWithStreamBlock", - fields=[ - ( - "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", - ), - ), - ( - "body", - fields.StreamField( - [ - ( - "struct_block", - blocks.StructBlock( - [ - ( - "title", - blocks.CharBlock(max_length=100), - ), - ( - "item", - blocks.StructBlock( - [ - ( - "label", - blocks.CharBlock(), - ), - ( - "value", - blocks.IntegerBlock(), - ), - ] - ), - ), - ( - "items", - blocks.ListBlock( - tests.testapp.models.MyBlockItem - ), - ), - ( - "image", - image_blocks.ImageChooserBlock(), - ), - ] - ), - ), - ("char_block", blocks.CharBlock()), - ], - ), - ), - ], - options={ - "abstract": False, - }, - bases=("wagtailcore.page",), - ), - migrations.CreateModel( - name="PageWithStreamBlockInListBlock", - fields=[ - ( - "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", - ), - ), - ( - "body", - fields.StreamField( - [ - ( - "list_block", - blocks.ListBlock( - blocks.StreamBlock( - [ - ( - "struct_block", - blocks.StructBlock( - [ - ( - "title", - blocks.CharBlock( - max_length=100 - ), - ), - ( - "item", - blocks.StructBlock( - [ - ( - "label", - blocks.CharBlock(), - ), - ( - "value", - blocks.IntegerBlock(), - ), - ] - ), - ), - ( - "items", - blocks.ListBlock( - tests.testapp.models.MyBlockItem - ), - ), - ( - "image", - image_blocks.ImageChooserBlock(), - ), - ] - ), - ), - ("char_block", blocks.CharBlock()), - ] - ) - ), - ) - ], - ), - ), - ], - options={ - "abstract": False, - }, - bases=("wagtailcore.page",), - ), - migrations.CreateModel( - name="PageWithStreamBlockInStructBlock", - fields=[ - ( - "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", - ), - ), - ( - "body", - fields.StreamField( - [ - ( - "struct_block", - blocks.StructBlock( - [ - ( - "inner_stream", - blocks.StreamBlock( - [ - ( - "struct_block", - blocks.StructBlock( - [ - ( - "title", - blocks.CharBlock( - max_length=100 - ), - ), - ( - "item", - blocks.StructBlock( - [ - ( - "label", - blocks.CharBlock(), - ), - ( - "value", - blocks.IntegerBlock(), - ), - ] - ), - ), - ( - "items", - blocks.ListBlock( - tests.testapp.models.MyBlockItem - ), - ), - ( - "image", - image_blocks.ImageChooserBlock(), - ), - ] - ), - ), - ( - "char_block", - blocks.CharBlock(), - ), - ] - ), - ) - ] - ), - ) - ], - ), - ), - ], - options={ - "abstract": False, - }, - bases=("wagtailcore.page",), - ), - migrations.AlterField( - model_name="mytestpage", - name="body", - field=fields.StreamField( - [ - ( - "char_array", - blocks.ListBlock(blocks.CharBlock()), - ), - ( - "int_array", - blocks.ListBlock(blocks.IntegerBlock()), - ), - ( - "struct", - blocks.StructBlock( - [ - ("title", blocks.CharBlock(max_length=100)), - ( - "item", - blocks.StructBlock( - [ - ("label", blocks.CharBlock()), - ("value", blocks.IntegerBlock()), - ] - ), - ), - ( - "items", - blocks.ListBlock(tests.testapp.models.MyBlockItem), - ), - ("image", image_blocks.ImageChooserBlock()), - ] - ), - ), - ("image", image_blocks.ImageChooserBlock()), - ], - ), - ), - ] diff --git a/tests/testapp/migrations/0003_alter_mytestpage_body_and_more.py b/tests/testapp/migrations/0003_alter_mytestpage_body_and_more.py deleted file mode 100644 index 5a4f1f7..0000000 --- a/tests/testapp/migrations/0003_alter_mytestpage_body_and_more.py +++ /dev/null @@ -1,313 +0,0 @@ -# Generated by Django 4.0.10 on 2023-05-16 04:25 - -import wagtail.blocks -import wagtail.documents.blocks -import wagtail.fields -import wagtail.images.blocks -from django.db import migrations - -import tests.testapp.models - - -class Migration(migrations.Migration): - - dependencies = [ - ("testapp", "0002_pagewithnestedstreamblock_and_more"), - ] - - operations = [ - migrations.AlterField( - model_name="mytestpage", - name="body", - field=wagtail.fields.StreamField( - [ - ( - "char_array", - wagtail.blocks.ListBlock(wagtail.blocks.CharBlock()), - ), - ( - "int_array", - wagtail.blocks.ListBlock(wagtail.blocks.IntegerBlock()), - ), - ( - "struct", - wagtail.blocks.StructBlock( - [ - ("title", wagtail.blocks.CharBlock(max_length=100)), - ( - "item", - wagtail.blocks.StructBlock( - [ - ("label", wagtail.blocks.CharBlock()), - ("value", wagtail.blocks.IntegerBlock()), - ] - ), - ), - ( - "items", - wagtail.blocks.ListBlock( - tests.testapp.models.MyBlockItem - ), - ), - ( - "image", - wagtail.images.blocks.ImageChooserBlock( - required=False - ), - ), - ] - ), - ), - ("page", wagtail.blocks.PageChooserBlock()), - ("image", wagtail.images.blocks.ImageChooserBlock()), - ("document", wagtail.documents.blocks.DocumentChooserBlock()), - ], - use_json_field=True, - ), - ), - migrations.AlterField( - model_name="pagewithnestedstreamblock", - name="body", - field=wagtail.fields.StreamField( - [ - ( - "inner_stream", - wagtail.blocks.StreamBlock( - [ - ( - "struct_block", - wagtail.blocks.StructBlock( - [ - ( - "title", - wagtail.blocks.CharBlock( - max_length=100 - ), - ), - ( - "item", - wagtail.blocks.StructBlock( - [ - ( - "label", - wagtail.blocks.CharBlock(), - ), - ( - "value", - wagtail.blocks.IntegerBlock(), - ), - ] - ), - ), - ( - "items", - wagtail.blocks.ListBlock( - tests.testapp.models.MyBlockItem - ), - ), - ( - "image", - wagtail.images.blocks.ImageChooserBlock( - required=False - ), - ), - ] - ), - ), - ("char_block", wagtail.blocks.CharBlock()), - ] - ), - ) - ], - use_json_field=True, - ), - ), - migrations.AlterField( - model_name="pagewithsimplestructblocknested", - name="body", - field=wagtail.fields.StreamField( - [ - ( - "inner_stream", - wagtail.blocks.StreamBlock( - [ - ( - "simple_struct_block", - wagtail.blocks.StructBlock( - [ - ("text", wagtail.blocks.CharBlock()), - ("number", wagtail.blocks.IntegerBlock()), - ("boolean", wagtail.blocks.BooleanBlock()), - ] - ), - ) - ] - ), - ) - ], - use_json_field=True, - ), - ), - migrations.AlterField( - model_name="pagewithstreamblock", - name="body", - field=wagtail.fields.StreamField( - [ - ( - "struct_block", - wagtail.blocks.StructBlock( - [ - ("title", wagtail.blocks.CharBlock(max_length=100)), - ( - "item", - wagtail.blocks.StructBlock( - [ - ("label", wagtail.blocks.CharBlock()), - ("value", wagtail.blocks.IntegerBlock()), - ] - ), - ), - ( - "items", - wagtail.blocks.ListBlock( - tests.testapp.models.MyBlockItem - ), - ), - ( - "image", - wagtail.images.blocks.ImageChooserBlock( - required=False - ), - ), - ] - ), - ), - ("char_block", wagtail.blocks.CharBlock()), - ], - use_json_field=True, - ), - ), - migrations.AlterField( - model_name="pagewithstreamblockinlistblock", - name="body", - field=wagtail.fields.StreamField( - [ - ( - "list_block", - wagtail.blocks.ListBlock( - wagtail.blocks.StreamBlock( - [ - ( - "struct_block", - wagtail.blocks.StructBlock( - [ - ( - "title", - wagtail.blocks.CharBlock( - max_length=100 - ), - ), - ( - "item", - wagtail.blocks.StructBlock( - [ - ( - "label", - wagtail.blocks.CharBlock(), - ), - ( - "value", - wagtail.blocks.IntegerBlock(), - ), - ] - ), - ), - ( - "items", - wagtail.blocks.ListBlock( - tests.testapp.models.MyBlockItem - ), - ), - ( - "image", - wagtail.images.blocks.ImageChooserBlock( - required=False - ), - ), - ] - ), - ), - ("char_block", wagtail.blocks.CharBlock()), - ] - ) - ), - ) - ], - use_json_field=True, - ), - ), - migrations.AlterField( - model_name="pagewithstreamblockinstructblock", - name="body", - field=wagtail.fields.StreamField( - [ - ( - "struct_block", - wagtail.blocks.StructBlock( - [ - ( - "inner_stream", - wagtail.blocks.StreamBlock( - [ - ( - "struct_block", - wagtail.blocks.StructBlock( - [ - ( - "title", - wagtail.blocks.CharBlock( - max_length=100 - ), - ), - ( - "item", - wagtail.blocks.StructBlock( - [ - ( - "label", - wagtail.blocks.CharBlock(), - ), - ( - "value", - wagtail.blocks.IntegerBlock(), - ), - ] - ), - ), - ( - "items", - wagtail.blocks.ListBlock( - tests.testapp.models.MyBlockItem - ), - ), - ( - "image", - wagtail.images.blocks.ImageChooserBlock( - required=False - ), - ), - ] - ), - ), - ("char_block", wagtail.blocks.CharBlock()), - ] - ), - ) - ] - ), - ) - ], - use_json_field=True, - ), - ), - ]