From cec8bd32f1266d9ef1e87a1488dc0e1573e68403 Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Tue, 20 Jan 2015 11:44:35 +0000 Subject: [PATCH] add bound_blocks accessor to StructValue (so that code for rendering a StructValue can access the native renderers of the individual items, if they want) --- wagtail/wagtailadmin/blocks.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wagtail/wagtailadmin/blocks.py b/wagtail/wagtailadmin/blocks.py index 4f892571a..492b3df9c 100644 --- a/wagtail/wagtailadmin/blocks.py +++ b/wagtail/wagtailadmin/blocks.py @@ -417,6 +417,13 @@ class StructValue(collections.OrderedDict): def __str__(self): return self.block.render(self) + @cached_property + def bound_blocks(self): + return collections.OrderedDict([ + (name, block.bind(self.get(name))) + for name, block in self.block.child_blocks.items() + ]) + class DeclarativeSubBlocksMetaclass(type): """