mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-12 09:13:14 +00:00
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)
This commit is contained in:
parent
81be94a34f
commit
cec8bd32f1
1 changed files with 7 additions and 0 deletions
|
|
@ -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):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue