Add solution type to server

This commit is contained in:
Ramon Wenger 2019-02-04 15:19:27 +01:00
parent 01791a9db5
commit 92d2901f9e
6 changed files with 666 additions and 642 deletions

View File

@ -68,4 +68,3 @@ pipelines:
prod:
- step: *unittest-python
- step: *deploy-prod

View File

@ -15,7 +15,7 @@ class LinkBlock(blocks.StructBlock):
url = blocks.URLBlock()
# 'text_block' 'task'
# 'text_block' 'solution'
class TextBlock(blocks.StructBlock):
class Meta:
icon = 'doc-full'

View File

@ -85,7 +85,7 @@ class VideoBlockFactory(wagtail_factories.StructBlockFactory):
model = VideoBlock
block_types = ['text_block', 'basic_knowledge', 'student_entry', 'image_url_block', 'task']
block_types = ['text_block', 'basic_knowledge', 'student_entry', 'image_url_block', 'solution']
class ContentBlockFactory(BasePageFactory):
@ -102,7 +102,7 @@ class ContentBlockFactory(BasePageFactory):
'image_url_block': ImageUrlBlockFactory,
'link_block': LinkBlockFactory,
'video_block': VideoBlockFactory,
'task': TextBlockFactory
'solution': TextBlockFactory
})
@classmethod
@ -129,7 +129,7 @@ class ContentBlockFactory(BasePageFactory):
if block_type == 'text_block':
kwargs['{}__{}__{}__{}'.format(stream_field_name, idx, block_type, field)] = RichText(
value[field])
elif block_type == 'task':
elif block_type == 'solution':
kwargs['{}__{}__{}__{}'.format(stream_field_name, idx, block_type, field)] = RichText(
value[field])
elif block_type == 'basic_knowledge':
@ -169,8 +169,8 @@ class ContentBlockFactory(BasePageFactory):
'{}__{}__{}__{}'.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':
kwargs['{}__{}__{}__{}'.format(stream_field_name, i, 'task', 'text')] = RichText(fake_paragraph())
elif block_type == 'solution':
kwargs['{}__{}__{}__{}'.format(stream_field_name, i, 'solution', 'text')] = RichText(fake_paragraph())
@classmethod
def create(cls, module, **kwargs):

View File

@ -41,7 +41,7 @@ class ContentBlock(StrictHierarchyPage):
('image_block', ImageChooserBlock()),
('image_url_block', ImageUrlBlock()),
('link_block', LinkBlock()),
('task', TextBlock(icon='tick')),
('solution', TextBlock(icon='tick')),
('video_block', VideoBlock()),
('document_block', DocumentBlock()),
], null=True, blank=True)

File diff suppressed because it is too large Load Diff

View File

@ -60,7 +60,7 @@ data = [
}
},
{
'type': 'task',
'type': 'text_block',
'value': {
'text': '<p>Erklären Sie, welche Informationen den Leserinnen und Lesern in der Einleitung vermittelt werden.</p>'
}
@ -104,7 +104,7 @@ data = [
}
},
{
'type': 'task',
'type': 'text_block',
'value': {
'text': '<p>Erklären Sie, welche Informationen den Leserinnen und Lesern in der Einleitung vermittelt werden.</p>'
}
@ -136,7 +136,7 @@ data = [
}
},
{
'type': 'task',
'type': 'text_block',
'value': {
'text': '<p>Erklären Sie, welche Informationen den Leserinnen und Lesern in der Einleitung vermittelt werden.</p>'
}
@ -161,7 +161,7 @@ data = [
}
},
{
'type': 'task',
'type': 'text_block',
'value': {
'text': '<p>Erklären Sie, welche Informationen den Leserinnen und Lesern in der Einleitung vermittelt werden.</p>'
}