-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug overwriting explicitly declared fields
Before, the `direct_fields` dict holding all fields declared in the custom serializer was overwritten with all implicitly defined fields from the `Meta` class inside the custom serializer. That means if someone declared anything other than a standard Field for an attribute of the model, this would have been overwritten with a standard Field instance instead of keeping the explicitly declared field type, effectively nullifying the effect of the explicit declaration. Now, if someone was to declare a field explicitly, the SerializerMeta class will not overwrite this field with a standard Field instance in the `direct_fields` dict, but will instead skip this field, thus preserving the explicit declaration. Also add some more comments explaining this in the code.
- Loading branch information
1 parent
2e53be0
commit d2b72b6
Showing
1 changed file
with
30 additions
and
13 deletions.
There are no files selected for viewing
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