You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi I red the coment below in instantiate_data_dictionaries:
# I'm not sure this is actually the best way to deserialize into nested dataclasses. The cleanest way seems to
# be overriding to_internal_value(), but the top-level serializer must return a dictionary from that method. We
# could split nested dataclasses off into a separate DataclassField (which could in general clean-up the code a
# bit), but that breaks specifying nested serializers using a single class. Let's use this ugly hack until I can
# think of something better.
First i want to congratulate you, with dataclasses django and python are becoming much better a robust to deploy productions services, I'm also front end developer and is amazing how with typescript and angular you can prevent a lot of bugs with de interfaces, I have been looking away to replacate that in backend, i tryed TypedDict, but my code steel been very dificult to debug, so when I started to use dataclasses and your library, the enpoint works like magic.
So I was wondering or I don't understand why you dont instance the main Dataclass instead of creating a Dict, if you want I can try to create this improvement.
Thanks again for your amazing work!
The text was updated successfully, but these errors were encountered:
Provoo
changed the title
Ideas to better way to instace of the dataclass instantiate_data_dictionaries
Ideas to a better way to instace of the dataclass instantiate_data_dictionaries
Feb 13, 2020
I'm not exactly sure what you mean though. This is just an implementation detail, for the enduser this is completely opaque and they already get an instance of the main dataclass.
The problem hinted at here is that the location where that dataclass is instantiated. Ideally, I'd want to do that in to_internal_value(), so that nesting automatically works. However, DRF doesn't allow us to do that on the outermost serializer, so we have to do it somewhere else. I don't see what your suggestion to change that is.
Hi I red the coment below in instantiate_data_dictionaries:
First i want to congratulate you, with dataclasses django and python are becoming much better a robust to deploy productions services, I'm also front end developer and is amazing how with typescript and angular you can prevent a lot of bugs with de interfaces, I have been looking away to replacate that in backend, i tryed TypedDict, but my code steel been very dificult to debug, so when I started to use dataclasses and your library, the enpoint works like magic.
So I was wondering or I don't understand why you dont instance the main Dataclass instead of creating a Dict, if you want I can try to create this improvement.
Thanks again for your amazing work!
The text was updated successfully, but these errors were encountered: