Forráskód Böngészése

Rename ImageBlock to CaptionedImageBlock

To avoid confusion with Wagtail's new built-in ImageBlock
Chiemezuo 9 hónapja
szülő
commit
13ba13b137

+ 3 - 3
bakerydemo/base/blocks.py

@@ -12,7 +12,7 @@ from wagtail.images import get_image_model
 from wagtail.images.blocks import ImageChooserBlock
 
 
-class ImageBlock(StructBlock):
+class CaptionedImageBlock(StructBlock):
     """
     Custom `StructBlock` for utilizing images with associated caption and
     attribution data
@@ -36,7 +36,7 @@ class ImageBlock(StructBlock):
 
     class Meta:
         icon = "image"
-        template = "blocks/image_block.html"
+        template = "blocks/captioned_image_block.html"
         preview_value = {"attribution": "The Wagtail Bakery"}
         description = "An image with optional caption and attribution"
 
@@ -108,7 +108,7 @@ class BaseStreamBlock(StreamBlock):
         ),
         description="A rich text paragraph",
     )
-    image_block = ImageBlock()
+    image_block = CaptionedImageBlock()
     block_quote = BlockQuote()
     embed_block = EmbedBlock(
         help_text="Insert an embed URL e.g https://www.youtube.com/watch?v=SGJFWirQ3ks",

+ 2 - 2
bakerydemo/recipes/blocks.py

@@ -13,7 +13,7 @@ from wagtail.contrib.typed_table_block.blocks import TypedTableBlock
 from wagtail.embeds.blocks import EmbedBlock
 from wagtail.images.blocks import ImageChooserBlock
 
-from bakerydemo.base.blocks import BlockQuote, HeadingBlock, ImageBlock
+from bakerydemo.base.blocks import BlockQuote, CaptionedImageBlock, HeadingBlock
 
 
 class RecipeStepBlock(StructBlock):
@@ -104,7 +104,7 @@ class RecipeStreamBlock(StreamBlock):
         },
     )
 
-    image_block = ImageBlock(group="Media")
+    image_block = CaptionedImageBlock(group="Media")
     embed_block = EmbedBlock(
         help_text="Insert an embed URL e.g https://www.youtube.com/watch?v=SGJFWirQ3ks",
         icon="media",

+ 0 - 0
bakerydemo/templates/blocks/image_block.html → bakerydemo/templates/blocks/captioned_image_block.html