Add double-spend safeguard

This commit is contained in:
Raphael Michel
2019-10-17 16:03:57 +02:00
parent ac2df35db6
commit b3e6f44027
8 changed files with 104 additions and 14 deletions

View File

@@ -977,7 +977,7 @@ class GiftCardDetailView(OrganizerDetailViewMixin, OrganizerPermissionRequiredMi
@transaction.atomic()
def post(self, request, *args, **kwargs):
self.object = self.get_object()
self.object = GiftCard.objects.select_for_update().get(pk=self.get_object().pk)
if 'value' in request.POST:
try:
value = DecimalField().to_python(request.POST.get('value'))