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
classPinnedObjectAdmin(ModelView, model=PinnedObject): # type: ignore[call-arg]def_build_url_for(self, name, request, obj):
# Need this bcuz of polymorphism: object can be NewsPinned or VacancyPinned# resulting in different generated URLsreturnrequest.url_for(
name,
identity=slugify_class_name(PinnedObject.__name__), # the original is `slugify_class_name(obj.__class__.__name__)`pk=get_object_identifier(obj),
)
Expected behavior
In the list view, the base url is pinned-object/list. When I click to one item it should beCCC
Actual behavior
However, link changes to news-pinned/edit/{id} or vacancy-pinned/edit/{id} resulting to 404 page. I had to overwrite _build_url_for function, to force class name to PinnedObject. I believe, instead of obj.__class__.__name__ it should take model of the AdminView.
Debugging material
No response
Environment
OS: Windows
Python: 3.11
SQLAdmin: 0.20.1
Additional context
No response
The text was updated successfully, but these errors were encountered:
Checklist
master
.Describe the bug
I have polymorphic models, and when I click "view" or "edit" its base url is changed, resulting in 404.
Steps to reproduce the bug
and when I create admin class for
PinnedObject
:Expected behavior
In the list view, the base url is
pinned-object/list
. When I click to one item it should beCCCActual behavior
However, link changes to
news-pinned/edit/{id}
orvacancy-pinned/edit/{id}
resulting to 404 page. I had to overwrite_build_url_for
function, to force class name to PinnedObject. I believe, instead ofobj.__class__.__name__
it should takemodel
of the AdminView.Debugging material
No response
Environment
Additional context
No response
The text was updated successfully, but these errors were encountered: