Created
June 21, 2013 17:33
-
-
Save donspaulding/5832861 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def partially_nested(serializer, include_fields=None, exclude_fields=None): | |
partial_fields = set(include_fields or []) - set(exclude_fields or []) | |
serializer.opts.exclude = tuple( | |
set(serializer.get_fields()) - set(partial_fields) | |
) | |
serializer.fields = serializer.get_fields() | |
return serializer | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment