mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-12 17:23:15 +00:00
Pick up the StreamBlock definition from the model field, so that we don't need to pass it to the StreamFieldPanel constructor
This commit is contained in:
parent
00f50781d1
commit
7f3c0f5af0
1 changed files with 2 additions and 5 deletions
|
|
@ -701,8 +701,6 @@ Page.settings_panels = [
|
|||
]
|
||||
|
||||
|
||||
from wagtail.wagtailadmin.blocks import StreamBlock
|
||||
|
||||
class BaseStreamFieldPanel(BaseFieldPanel):
|
||||
|
||||
def classes(self):
|
||||
|
|
@ -727,13 +725,12 @@ class BaseStreamFieldPanel(BaseFieldPanel):
|
|||
return cls.block_def.all_html_declarations()
|
||||
|
||||
class StreamFieldPanel(object):
|
||||
def __init__(self, field_name, block_types):
|
||||
def __init__(self, field_name):
|
||||
self.field_name = field_name
|
||||
self.block_types = block_types
|
||||
|
||||
def bind_to_model(self, model):
|
||||
return type(str('_StreamFieldPanel'), (BaseStreamFieldPanel,), {
|
||||
'model': model,
|
||||
'field_name': self.field_name,
|
||||
'block_def': StreamBlock(self.block_types),
|
||||
'block_def': model._meta.get_field(self.field_name).stream_block
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue