-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
404 for actions returned by get_object_actions() but not in objectactions #25
Comments
Sounds annoying. The example project's admin is really... too simple right now. I rely on it to document all the ways object actions could be used. Before tackling this, I (or some helpful person) would need to flesh out the example admin to recreate this scenario. |
I could look at fleshing out the example admin a bit, but would you be interested in merging a more elaborate fix for this? I see three possible approaches:
I'm not a fan of the first option, since having to both specify the attribute value and override the method is inconsistent with the rest of ModelAdmin's customisation hooks, there's no error at runtime until you hit the 404, and implementing The second option is an improvement since it's more consistent with how ModelAdmin's other customisation hooks work, but you will get either missing actions or the mysterious 404 if you forget to implement both The third option sucks because it is also inconsistent with ModelAdmin's customisation hooks, but at least implementers will get an error thrown when it is called by So, I'd go with the third. Thoughts? |
I tried thinking through this today, and I have one idea in my head that's not the same as what you're thinking. I haven't got the imagination right now to visualize what you're describing. |
Are there any fixes available for this issue? I want to use these actions but i need the runtime customization of available actions per object. |
I've faced the same issue just now.
I don't know whether it should be fixed or not, but such a behavior should be mentioned in documentation to avoid same questions in the future. |
Currently if an admin view overrides
get_object_actions()
and returns an action not contained in theobjectactions
view's attr, then invoking the action from the admin interface results in a 404.This occurs because
BaseDjangoObjectActions. get_tool_urls
usesself. objectactions
, notself.get_object_actions()
.It seems this might be unavoidable, but is unexpected since it's not documented, and annoying if you're trying to create a base/mixin admin view class that use
get_object_actions()
to provide actions in addition to subclasses that provide their own.The text was updated successfully, but these errors were encountered: