Add 'tree_navigable' option to PageChooserPanel and PageChooserBlock
See original GitHub issueThe ability to limit PageChooserPanel choices to instances of a specific page type was a welcome addition and works beautifully when those page types can exist in multiple locations throughout the site. However, it’s often the case that certain page types only live under a single page (e.g. events, news articles, blog posts etc), in which case, starting at the root level of the explorer-like listing is not ideal.
I propose a tree_navigable
option be added to PageChooserPanel
and PageChooserBlock
to give developers the option to specify whether the chooser should render as it does currently (the default option), or whether is jumps straight into a list of pages that match the specified type(s) (with the most recently modified pages appearing first)
The search function within the widget already limits the results to those that match the type, so that wouldn’t need to change. I also think it would be possible in this case to ditch the message above the list.
Any thoughts?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top GitHub Comments
I certainly like the idea of automatically choosing a better starting point based the queryset, but It’s still valuable as a developer to be able to have that extra level of control. Plus, the automated option still might not be optimal. For example:
Say you want the editor to be able to pick an Article, but Articles are dotted around under numerous listing pages throughout the tree. It’s probably of little importance to the editor where the article lives, so navigating through the tree might not make sense to them in that context. If using ModelAdmin (especially with
exclude_from_explorer=True
- #2771 ), they might not even be aware that articles are part of the tree - they manage them all from the same listing page in the CMS.There are other benefits to be gained also: such as getting rid of the (likely unselectable) parent page at the top, and even ditching the rightmost column (used to navigate to children) to give the listing more space. The warning too (that appears currently) can also be ditched, because they won’t see any other types of page in that listing.
There is a related issue: #1806. Also see this comment.
Probably generic chooser with the UI similar (or even exactly the same) as for snippet chooser will solve this problem.