Skip to content

Commit 25b096c

Browse files
mwvoloTomWoodward
andauthored
make book labels more clear (#1629)
* make book labels more clear * rearrange things * Default label --------- Co-authored-by: tom <[email protected]>
1 parent 9b3242f commit 25b096c

File tree

4 files changed

+838
-10
lines changed

4 files changed

+838
-10
lines changed

pages/custom_blocks.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -326,13 +326,12 @@ def get_api_representation(self, value, context=None):
326326
'title': value['title'],
327327
}
328328

329-
class BookListBlock(blocks.StructBlock):
330-
books = blocks.PageChooserBlock(page_type=['books.Book'], required=False)
331-
332-
class Meta:
333-
icon = 'placeholder'
334-
label = "Books"
329+
class BookBlock(blocks.PageChooserBlock):
330+
def __init__(self, *args, **kwargs):
331+
kwargs['page_type'] = ['books.Book']
332+
kwargs['label'] = kwargs.get('label', 'Book')
333+
super().__init__(*args, **kwargs)
335334

336335
def get_api_representation(self, value, context=None):
337336
if value:
338-
return get_book_data(value['books'])
337+
return get_book_data(value)

0 commit comments

Comments
 (0)