-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
My model need output _id field to frontend of my project.
def dict(self, *args, **kwargs) -> dict:
"""
Removes excluded fields based on `Meta` and `kwargs`
:return: dict of serializer data fields
"""
exclude = kwargs.get("exclude")
if not exclude:
exclude = set()
**exclude.update({"_id"})**
if hasattr(self.Meta, "exclude") and self.Meta.exclude:
exclude.update(self.Meta.exclude)
if (
hasattr(self.Meta, "write_only_fields")
and self.Meta.write_only_fields
):
exclude.update(self.Meta.write_only_fields)
kwargs.update({"exclude": exclude})
original = super().dict(*args, **kwargs)
return originalMetadata
Metadata
Assignees
Labels
No labels