You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We'd like to be able to order and filter the search results of a PageChooserBlock modal.
Describe the solution you'd like
Ability to click on the column headings TITLE | UPDATED | TYPE | STATUS to be able to sort the results by that column
Ability to filter search results by page type by clicking on the page_type
Describe alternatives you've considered
None yet.
Additional context
Screenshot of our page chooser modal in Wagtail admin with the columns we'd like to be able to sort by highlighted in the red box:
This is what our chooser_blocks.py currently looks like:
...
classEventAndArticlePageChooserBlock(PageChooserBlock):
"""Select appropriate API representation based on page type."""def__init__(self, **kwargs):
"""Overwrite __init__ to only allow event pages and article pages."""kwargs["page_type"] = (
"events.EventPage",
"articles.ArticlePage",
"education.EducationEvent",
"education.EducationResource",
"collectables.CreatorPage",
)
super().__init__(**kwargs)
defget_api_representation(self, value, context=None):
"""Return API representation based on page type."""ifvalueisNone: # is an event has been deletedreturnNoneif ("ArticlePage"instr(value.specific_class)
or"EducationResource"instr(value.specific_class)):
returnArticlePageCardSerializer().to_representation(value.specific)
if ("CreatorPage"instr(value.specific_class)):
returnCreatorPageCardSerializer().to_representation(value.specific)
returnEventCardSerializer().to_representation(value.specific)
classRelatedEventsAndArticlesBlock(StructBlock):
"""A block that displays related pages in a carousel format."""heading=CharBlock()
pages=ListBlock(EventAndArticlePageChooserBlock())
classMeta:
label="Related Pages"
...
The text was updated successfully, but these errors were encountered:
Is your proposal related to a problem?
We'd like to be able to order and filter the search results of a
PageChooserBlock
modal.Describe the solution you'd like
TITLE | UPDATED | TYPE | STATUS
to be able to sort the results by that columnpage_type
Describe alternatives you've considered
None yet.
Additional context
Screenshot of our page chooser modal in Wagtail admin with the columns we'd like to be able to sort by highlighted in the red box:
This is what our
chooser_blocks.py
currently looks like:The text was updated successfully, but these errors were encountered: