Define edit handlers / panels on model with class methods
Problem statement
When models (pages, snippets, etc.) inherit from one another then it is pretty cumbersome to customize the panels (edit handler) on the child class. The only thing that works relatively straightforward is appending. However, this will lead to non-ideal ordering and grouping of fields as we can only extend the list at the bottom. Even at the top is weird because we typically want the title to be first.
Proposed solution
Instead of defining the panels as static props on the class, it would be great to have the option to define them as classmethods (e.g. get_content_panels or get_edit_handlers).
This would allow you to create more custom groupings for the panels with custom classmethods. Then the known classmethods (like get_content_panels) could use those custom methods.
Alternative solutions
No response
Additional context
No response
Working on this
Contribute to the discussion to help this move forward. Explain your use cases, discuss possible solutions, research how to adapt existing code, or compatibility concerns.
Once others agree with the proposed changes, anyone can contribute to this. View our contributing guidelines. Add a comment to the issue to explain what approach you are taking.
Source: wagtail/wagtail