Wagtail: How to render the blocks dynamically on Admin panel?

Viewed 106

In wagtail, I need to make a Struct/Stream Block There is a dropdown on the top of the block(Image/Video) If editor choose Image, VideoChooserBlock should be hidden. And if editor choose Video, ImageChooserBlock should be hidden.

class MyBlock(StruckBlock):
   category = ChoiceBlock(choices=(("image", "image"),("video", "video")))
   image = ImageChooserBlock()
   video = videoChooserBlock()

Here, editor should be able to choose only image or video depending on category. Any help is appriciated. Thanks

1 Answers
Related