Update factory to include image URL block generation
This commit is contained in:
parent
8811829e3a
commit
e524fe6107
|
|
@ -85,7 +85,7 @@ class VideoBlockFactory(wagtail_factories.StructBlockFactory):
|
||||||
model = VideoBlock
|
model = VideoBlock
|
||||||
|
|
||||||
|
|
||||||
block_types = ['text_block', 'basic_knowledge', 'student_entry', 'image_block', 'task']
|
block_types = ['text_block', 'basic_knowledge', 'student_entry', 'image_url_block', 'task']
|
||||||
|
|
||||||
|
|
||||||
class ContentBlockFactory(BasePageFactory):
|
class ContentBlockFactory(BasePageFactory):
|
||||||
|
|
@ -176,9 +176,12 @@ class ContentBlockFactory(BasePageFactory):
|
||||||
elif block_type == 'assignment':
|
elif block_type == 'assignment':
|
||||||
kwargs['{}__{}__{}__{}'.format(stream_field_name, i, 'assignment', 'task_text')] = RichText(
|
kwargs['{}__{}__{}__{}'.format(stream_field_name, i, 'assignment', 'task_text')] = RichText(
|
||||||
fake_paragraph())
|
fake_paragraph())
|
||||||
elif block_type == 'image_block':
|
elif block_type == 'image_url_block':
|
||||||
kwargs[
|
kwargs[
|
||||||
'{}__{}__{}__{}'.format(stream_field_name, i, 'image_block', 'image__title')] = fake_paragraph()
|
'{}__{}__{}__{}'.format(stream_field_name, i, 'image_url_block', 'title')] = fake_paragraph()
|
||||||
|
kwargs[
|
||||||
|
'{}__{}__{}__{}'.format(stream_field_name, i, 'image_url_block',
|
||||||
|
'url')] = 'https://picsum.photos/400/?random={}'.format(''.join(random.choice('abcdefghiklmn') for _ in range(6)))
|
||||||
elif block_type == 'task':
|
elif block_type == 'task':
|
||||||
kwargs['{}__{}__{}__{}'.format(stream_field_name, i, 'task', 'text')] = RichText(fake_paragraph())
|
kwargs['{}__{}__{}__{}'.format(stream_field_name, i, 'task', 'text')] = RichText(fake_paragraph())
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue