Adds a get_action_url_for_obj
method to AdminURLHelper
#3655
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a small part of a larger piece of work I'm doing on ButtonHelper wagtail-nest/wagtail-modeladmin#7, where I'm calling on AdminURLHelper a little more, and it's becoming untidy to keep ensuring a 'quoted' version of an object's primary key is available to pass to
get_action_url
. Even without the rest of the changes, I'd still consider this a useful change that removes some of the 'special case' code from the views incontrib.modeladmin
, which will undoubtedly help when it comes to refactoring on wagtailadmin's generic views / viewsets.get_action_url_for_obj
method to AdminURLHelper that will extract and quote a primary key from an object and provide it (as the first item) toget_action_url
along with any other supplied args or keyword argsget_action_url
NOTE: I would recommend deprecating the
pk_quoted
attribute onInstanceSpecificView
, but I would rather do that separately after #3650 and this have been merged.