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

Pass serializer context to virtual model #33

Open
jackson541 opened this issue Jan 27, 2023 · 1 comment
Open

Pass serializer context to virtual model #33

jackson541 opened this issue Jan 27, 2023 · 1 comment

Comments

@jackson541
Copy link
Contributor

Hello!

Sometimes, I need to make more complex queries that involve values that are not available in the current object of virtual model and I could pass them using serializer context. But, I can not do this in the current version because the only value that goes from the serializer to the virtual model is the request user.

image

Thanks for the attention!

@fjsj
Copy link
Member

fjsj commented Jan 27, 2023

Hi @jackson541 , thanks for the input. For now, you can override this method to provide additional parameters at line 77. I suggest you to make your own base class and use it instead of the default VirtualModelSerializerMixin or VirtualModelSerializer. For now, that's the fastest solution. But if you can open a PR to include the serializer context at line 77, I'm happy to merge it. Please include tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants