Skip to content
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

Adds a get_action_url_for_obj method to AdminURLHelper #3655

Conversation

ababic
Copy link
Contributor

@ababic ababic commented Jun 14, 2017

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 in contrib.modeladmin, which will undoubtedly help when it comes to refactoring on wagtailadmin's generic views / viewsets.

  • Adds a 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) to get_action_url along with any other supplied args or keyword args
  • Updates various view methods to make use of the new method, instead of having to pass in an unquoted primary key to get_action_url

NOTE: I would recommend deprecating the pk_quoted attribute on InstanceSpecificView, but I would rather do that separately after #3650 and this have been merged.

…extract and quote a primary key from an object and provide it (as the first item) to `get_action_url` along with any other supplied args or keyword args

- Updates various view methods to make use of the new method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants