Does DRF CreateModelMixin break atomicity? #9196
-
According to the DRF documentation, serializers should be expected to both create a model object and save to the db, by using a Granted, it appears that this would only happen if the serializer-created object fails serializer-validation, which shouldn't happen. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
A colleague has helped me to find my error here. I had believed that the serializer's |
Beta Was this translation helpful? Give feedback.
A colleague has helped me to find my error here. I had believed that the serializer's
__init__
method would callcreate()
, but this is not so -- despite the intuitive appeal of the constructor being the place where "create" happens, that in fact occurs insave()
, which entirely moots my concern.