class MyMapper(StreamFieldMapper):
image = ImageConverter('my_image_block')
heading = TextConverter('my_heading_block')
html = RichTextConverter('my_paragraph_block')
# table = TableConverter('my_table_block')
section_blocks = [("my_heading_block",CharBlock()),
("my_paragraph_block" ,RichTextBlock()),
( "my_image_block", ImageChooserBlock()),]
class DemoPage(HeadlessPreviewMixin, BasePage, ContentImportMixin):
rich_text_1 = RichTextField(blank=True, null=True, verbose_name=_("Content"))
body = StreamField(
section_blocks,use_json_field=True, blank=True, null=True, verbose_name=_("Content Sections"))
content_panels = BasePage.content_panels + [FieldPanel("rich_text_1"),FieldPanel("body", classname="full")]
extra_panels = BasePage.extra_panels
mapper_class = MyMapper
objects: PageManager
class Meta:
verbose_name = _("Demo")
It imports heading tags but does not import images. I tried using
tag in the file, inserting image directly in the file, still while importing the .docx file, it does not import the image. Help me.
//demo.py
It imports heading tags but does not import images. I tried using
tag in the file, inserting image directly in the file, still while importing the .docx file, it does not import the image. Help me.