-
Notifications
You must be signed in to change notification settings - Fork 29
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
Get rid of warning #27
Comments
i don't have any special love for the warning. Removing it would be a positive thing for my code. As for optionally warning or not, there might be a few ways to go about it.
|
Finally another option completely (to work around this with existing code) is to provide a clean serializer in your codebase without the dynamic field mixin, and a second serializer which simply inherits the first with the mixin. e.g.
|
I like that. Implemented in #28. |
I have a use case where I need to dynamically determine the nested serializer like this:
This works but results in a warning, because the nested serializer does not have access to the request in the context.
If we pass in the context...
...then the warning is gone, but the filtering is applied to those fields too.
The problem is that drf-dynamic-fields cannot know that this serializer is a nested serializer because it's used like a root serializer. And I'm afraid of playing some tricks with parent/child attributes, since that can go wrong easily.
I see two approaches to solve this:
dynamic_fields_ignore
) that is queried in order to ignore the filtering on this serializer.I'm undecided. What do you think @jtrain?
The text was updated successfully, but these errors were encountered: