Checklist
Describe the bug
Hello!
When using BaseView with multiple methods decorated by @expose, the link that appears in the admin menu is determined by the last method (by alphabetical order) with @expose, regardless of the identity parameter or the order in the class.
Expected behavior:
The menu link should be determined by either:
The first method with @expose (by code order), or
The method with a specific identity (if set), or
Allow explicit control (e.g. via a class attribute or parameter).
Actual behavior:
The menu link always points to the endpoint of the last method (by alphabetical order) with @expose.
Even if I set identity explicitly in the class or in the decorator, it gets overwritten.
class OrdersView(BaseView):
name = "Orders"
identity = "ordersview"
@expose("/orders", identity="ordersview", methods=["GET"])
async def orders_list(self, request):
...
@expose("/orders/bulk-action", methods=["POST"])
async def orders_bulk_action(self, request):
...
In this case, the menu link points to /orders/bulk-action instead of /orders.
Why this is a problem:
It is not intuitive and makes it impossible to control which endpoint is shown in the menu without hacks (like renaming methods).
Explicit identity is ignored if there are multiple @expose methods.
Suggested solution:
Assign identity only once (for the first @expose method found), or
Allow explicit control via a class attribute or decorator parameter, or
Document the current behavior and recommend best practices.
Thank you for your work on this great project!
Steps to reproduce the bug
No response
Expected behavior
No response
Actual behavior
No response
Debugging material
No response
Environment
- SQLAdmin version: 0.20.1
- Python version: 3.11
- Database: PostgreSQL 15
- Running inside Docker: yes
- OS: Ubuntu 22.04 (inside container)
Additional context
No response
Checklist
master.Describe the bug
Hello!
When using BaseView with multiple methods decorated by @expose, the link that appears in the admin menu is determined by the last method (by alphabetical order) with @expose, regardless of the identity parameter or the order in the class.
Expected behavior:
The menu link should be determined by either:
The first method with @expose (by code order), or
The method with a specific identity (if set), or
Allow explicit control (e.g. via a class attribute or parameter).
Actual behavior:
The menu link always points to the endpoint of the last method (by alphabetical order) with @expose.
Even if I set identity explicitly in the class or in the decorator, it gets overwritten.
In this case, the menu link points to /orders/bulk-action instead of /orders.
Why this is a problem:
It is not intuitive and makes it impossible to control which endpoint is shown in the menu without hacks (like renaming methods).
Explicit identity is ignored if there are multiple @expose methods.
Suggested solution:
Assign identity only once (for the first @expose method found), or
Allow explicit control via a class attribute or decorator parameter, or
Document the current behavior and recommend best practices.
Thank you for your work on this great project!
Steps to reproduce the bug
No response
Expected behavior
No response
Actual behavior
No response
Debugging material
No response
Environment
Additional context
No response