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

Restructure SchemaGenerator for easier subclassing #5271

Conversation

IvanAnishchuk
Copy link

@IvanAnishchuk IvanAnishchuk commented Jul 13, 2017

Restructure SchemaGenerator to allow easier subclassing. In particular, to make adding new list actions (e.g. bulk update) easy.

It's absolutely crucial for using interactive documentation in conjunction with DRF-bulk — doing otherwise requires maintaining about a hundred lines of pointless copy-paste. (In particular I need it for this)

The whole changeset is basically just moving is_custom_action and is_list_view functions to the class so they can be overridden and use class attributes in conditions instead of hardcoded values. Shouldn't break anything unless those functions are used directly somewhere in the code (however I could provide compatibility just if required).

Allow adding new default list actions so that bulk actions can be
included in the schema with minimal changes.
@carltongibson
Copy link
Collaborator

This is superseded by #5354.

Advice now:

Subclass AutoSchema to make your required customisations. (Override get_link or any of the helper methods.)

Interested in any sticking points there.

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.

2 participants