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

Subclassable get_* filter and omit params #21

Open
nhaggmark opened this issue Feb 8, 2018 · 1 comment
Open

Subclassable get_* filter and omit params #21

nhaggmark opened this issue Feb 8, 2018 · 1 comment

Comments

@nhaggmark
Copy link

nhaggmark commented Feb 8, 2018

Thanks for writing and maintaining this incredibly useful library. I recently ran into a situation where I need to be able to control my serialization dynamically outside of just using URL params. One suggestion that I had for improving this library would be to encapsulate the acquisition of your include and omit lists into it's own method (or set of methods) so that it can be overridden by subclassing (if, perhaps, you wanted to use a different url parameter or even a whole different source, such as the serializer context). That's what I did in my current project.

Cheers!

@jtrain
Copy link
Collaborator

jtrain commented Feb 9, 2018

Hey thanks! I'll admit I'm having some trouble following your suggestion. Are you able to give a real life (or realistic) example so I can get it clear in my mind?

would it be something like adding:

def get_omit_params(self):

and

def get_filter_params(self):

rather than what's happening here: https://github.com/dbrgn/drf-dynamic-fields/blob/master/drf_dynamic_fields/__init__.py#L51

@jtrain jtrain changed the title I love the lib! Subclassable get_* filter and omit params Mar 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants