-
Notifications
You must be signed in to change notification settings - Fork 116
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
Atomic transaction #48
Comments
@kenny1992 suggested to determine the root serializer depending on |
We use a The opposite is also possible. Someone may consider the data critical even if a signal were to fail. Forcing them to wrap the In general, I'm +1 on wrapping calls in transactions. It strikes me as the safe default. If someone has to improve their code (by handling errors in signal handlers) to upgrade |
I'd love to see this happen as it's not obvious to me how to implement the feature in the current state of the library. |
Wouldn't adding something like this be enough? class AtomicNestedCreateMixin(NestedCreateMixin):
def save(self, **kwargs):
with transaction.atomic():
return super().save(**kwargs) |
厉害! |
Now, to avoid partial object creation you should wrap your root serializer's
save()
intotransaction.atomic
.I'm not sure about wrapping
save()
in the library in each serializer with mixin. What do you think?The text was updated successfully, but these errors were encountered: