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
feat: implement magic methods #633
Conversation
oh i forgot embed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tried adding this __setattr__
magic style into the serializer itself? The issue boils down to trying to recursively remap the attributes we've added to our serialization subclass.
I don't quite understand how you mean that |
I believe they were asking if you've tried implementing this: def __setattr__(self, key, value) -> None:
super().__setattr__(key, value)
if key != "_json" and (key not in self._json or value != self._json.get(key)):
if value is not None and value is not MISSING:
self._json.update({key: value})
elif value is None and key in self._json.keys():
del self._json[key] within the serialiser mixin itself and not just the objects in question |
I didn't do that, I also don't see where it would be useful since it is only called once and the other |
Implement magic methods to make usage of models easier for users
Checklist
pre-commit
to format and lint the change(s) made.3.8.6
and higher._json
in models to make user changes to them easier #624