11from django .core .management .base import (
22 BaseCommand , CommandError
33)
4- from eureka .main .blocks import VideoEmbedBlock
54from eureka .main .models import (
65 HomePage , ImprovisationTypeIndexPage , ImprovisationTypePage ,
76 EarTrainingIndexPage , EarTrainingLevelPage ,
87 EarTrainingElementContainerPage , EarTrainingElementPage ,
98 ImprovisationCombinationIndexPage , ImprovisationCombinationPage
109)
11- from wagtail .core .blocks import StreamBlock , StreamValue , RichTextBlock
1210from wagtail .core .models import Page , Site
13- from wagtail .core .rich_text import RichText
1411from wagtailmenus .conf import settings
1512
1613IMPROV_TYPE_LIST = [
@@ -33,73 +30,70 @@ def create_ear_training_elements(et_root_page, element_list):
3330 imp_type_page = EarTrainingElementPage (
3431 title = improv_type
3532 )
36- imp_type_page .body = [('topic' , {
37- 'title' : 'Out of Tempo' ,
38- 'musical_elements' : [{
39- 'element_title' : 'Beginner' ,
40- 'content' : StreamValue (
41- stream_block = StreamBlock ([
42- ('rich_text' , RichTextBlock ()),
43- ]),
44- stream_data = [
45- ('rich_text' , RichText ('<p>TBD</p>' )),
46- ]
47- )
48- }, {
49- 'element_title' : 'Intermediate' ,
50- 'content' : StreamValue (
51- stream_block = StreamBlock ([
52- ('rich_text' , RichTextBlock ()),
53- ]),
54- stream_data = [
55- ('rich_text' , RichText ('<p>TBD</p>' )),
56- ]
57- )
58- }, {
59- 'element_title' : 'Advanced' ,
60- 'content' : StreamValue (
61- stream_block = StreamBlock ([
62- ('rich_text' , RichTextBlock ()),
63- ]),
64- stream_data = [
65- ('rich_text' , RichText ('<p>TBD</p>' )),
66- ]
67- )
68- }]
69- }), ('topic' , {
70- 'title' : 'In Tempo' ,
71- 'musical_elements' : [{
72- 'element_title' : 'Beginner' ,
73- 'content' : StreamValue (
74- stream_block = StreamBlock ([
75- ('rich_text' , RichTextBlock ()),
76- ]),
77- stream_data = [
78- ('rich_text' , RichText ('<p>TBD</p>' )),
79- ]
80- )
81- }, {
82- 'element_title' : 'Intermediate' ,
83- 'content' : StreamValue (
84- stream_block = StreamBlock ([
85- ('rich_text' , RichTextBlock ()),
86- ]),
87- stream_data = [
88- ('rich_text' , RichText ('<p>TBD</p>' )),
89- ]
90- )
91- }, {
92- 'element_title' : 'Advanced' ,
93- 'content' : StreamValue (
94- stream_block = StreamBlock ([
95- ('rich_text' , RichTextBlock ()),
96- ]),
97- stream_data = [
98- ('rich_text' , RichText ('<p>TBD</p>' )),
99- ]
100- )
101- }]
102- })]
33+ imp_type_page .body = [
34+ {
35+ 'type' : 'topic' ,
36+ 'value' : {
37+ 'title' : 'Out of Tempo' ,
38+ 'musical_elements' : [{
39+ 'element_title' : 'Beginner' ,
40+ 'content' : [
41+ {
42+ 'type' : 'rich_text' ,
43+ 'value' : '<p>TBD</p>'
44+ }
45+ ]
46+ }, {
47+ 'element_title' : 'Intermediate' ,
48+ 'content' : [
49+ {
50+ 'type' : 'rich_text' ,
51+ 'value' : '<p>TBD</p>'
52+ }
53+ ]
54+ }, {
55+ 'element_title' : 'Advanced' ,
56+ 'content' : [
57+ {
58+ 'type' : 'rich_text' ,
59+ 'value' : '<p>TBD</p>'
60+ }
61+ ]
62+ }]
63+ }
64+ },
65+ {
66+ 'type' : 'topic' ,
67+ 'value' : {
68+ 'title' : 'In Tempo' ,
69+ 'musical_elements' : [{
70+ 'element_title' : 'Beginner' ,
71+ 'content' : [
72+ {
73+ 'type' : 'rich_text' ,
74+ 'value' : '<p>TBD</p>'
75+ }
76+ ]
77+ }, {
78+ 'element_title' : 'Intermediate' ,
79+ 'content' : [
80+ {
81+ 'type' : 'rich_text' ,
82+ 'value' : '<p>TBD</p>'
83+ }
84+ ]
85+ }, {
86+ 'element_title' : 'Advanced' ,
87+ 'content' : [
88+ {
89+ 'type' : 'rich_text' ,
90+ 'value' : '<p>TBD</p>'
91+ }
92+ ]
93+ }]
94+ }
95+ }
96+ ]
10397 element_container .add_child (instance = imp_type_page )
10498 imp_type_page .save_revision ().publish ()
10599
@@ -137,7 +131,10 @@ def handle(self, *args, **options):
137131 for improv_type in IMPROV_TYPE_LIST :
138132 improv_type_page = ImprovisationTypePage (
139133 title = improv_type ,
140- body = [('rich_text' , RichText ('<p>TBD</p>' ))]
134+ body = [{
135+ 'type' : 'rich_text' ,
136+ 'value' : '<p>TBD</p>'
137+ }]
141138 )
142139 improv_type_index .add_child (instance = improv_type_page )
143140 improv_type_page .save_revision ().publish ()
@@ -155,7 +152,10 @@ def handle(self, *args, **options):
155152 title = 'Introduction to Ear Training One' ,
156153 tab_title = 'Ear Training One' ,
157154 show_in_menus = True ,
158- body = [('rich_text' , RichText ('<p>TBD</p>' ))]
155+ body = [{
156+ 'type' : 'rich_text' ,
157+ 'value' : '<p>TBD</p>'
158+ }]
159159 )
160160 ear_training_index .add_child (instance = et_one )
161161 et_one .save_revision ().publish ()
@@ -173,19 +173,19 @@ def handle(self, *args, **options):
173173 'title' : 'Out of tempo' ,
174174 'musical_elements' : [{
175175 'element_title' : 'Out of tempo with intervals' ,
176- 'content' : StreamValue (
177- stream_block = StreamBlock ([
178- ( 'rich_text' , RichTextBlock ()) ,
179- ( 'video' , VideoEmbedBlock ()),
180- ]) ,
181- stream_data = [
182- ( 'rich_text' , RichText ( '<p>TBD</p>' )) ,
183- ( 'video' , {
176+ 'content' : [
177+ {
178+ 'type' : 'rich_text' ,
179+ 'value' : '<p>TBD</p>'
180+ } ,
181+ {
182+ 'type' : 'video' ,
183+ 'value' : {
184184 'url' : YT_TEST_VIDEO ,
185185 'description' : 'A very fine video'
186- }),
187- ]
188- )
186+ }
187+ }
188+ ]
189189 }]
190190 })]
191191 et_page .save_revision ().publish ()
@@ -195,7 +195,10 @@ def handle(self, *args, **options):
195195 title = 'Introduction to Ear Training Two' ,
196196 tab_title = 'Ear Training Two' ,
197197 show_in_menus = True ,
198- body = [('rich_text' , RichText ('<p>TBD</p>' ))]
198+ body = [{
199+ 'type' : 'rich_text' ,
200+ 'value' : '<p>TBD</p>'
201+ }]
199202 )
200203 ear_training_index .add_child (instance = et_two )
201204 et_two .save_revision ().publish ()
@@ -212,7 +215,10 @@ def handle(self, *args, **options):
212215 title = 'Introduction to Ear Training Three' ,
213216 tab_title = 'Ear Training Three' ,
214217 show_in_menus = True ,
215- body = [('rich_text' , RichText ('<p>TBD</p>' ))]
218+ body = [{
219+ 'type' : 'rich_text' ,
220+ 'value' : '<p>TBD</p>'
221+ }]
216222 )
217223 ear_training_index .add_child (instance = et_three )
218224 et_three .save_revision ().publish ()
@@ -229,7 +235,10 @@ def handle(self, *args, **options):
229235 title = 'Introduction to Ear Training Four' ,
230236 tab_title = 'Ear Training Four' ,
231237 show_in_menus = True ,
232- body = [('rich_text' , RichText ('<p>TBD</p>' ))]
238+ body = [{
239+ 'type' : 'rich_text' ,
240+ 'value' : '<p>TBD</p>'
241+ }]
233242 )
234243 ear_training_index .add_child (instance = et_four )
235244 et_four .save_revision ().publish ()
@@ -255,7 +264,10 @@ def handle(self, *args, **options):
255264 combo_page = ImprovisationCombinationPage (
256265 title = i ,
257266 show_in_menus = True ,
258- body = [('rich_text' , RichText ('<p>TBD</p>' ))]
267+ body = [{
268+ 'type' : 'rich_text' ,
269+ 'value' : '<p>TBD</p>'
270+ }]
259271 )
260272 improv_combo_index .add_child (instance = combo_page )
261273 combo_page .save_revision ().publish ()
0 commit comments