1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-21 01:48:21 +02:00

All transactions are now atomic

This commit is contained in:
Yohann D'ANELLO
2020-09-11 22:52:16 +02:00
parent 860c7b50e5
commit 9b090a145c
15 changed files with 61 additions and 20 deletions

View File

@ -38,6 +38,7 @@ class CustomLoginView(LoginView):
"""
form_class = CustomAuthenticationForm
@transaction.atomic
def form_valid(self, form):
logout(self.request)
_set_current_user_and_ip(form.get_user(), self.request.session, None)
@ -76,6 +77,7 @@ class UserUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView):
return context
@transaction.atomic
def form_valid(self, form):
"""
Check if ProfileForm is correct
@ -269,6 +271,7 @@ class PictureUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin, Det
self.object = self.get_object()
return self.form_valid(form) if form.is_valid() else self.form_invalid(form)
@transaction.atomic
def form_valid(self, form):
"""Save image to note"""
image = form.cleaned_data['image']
@ -650,6 +653,7 @@ class ClubAddMemberView(ProtectQuerysetMixin, ProtectedCreateView):
return not error
@transaction.atomic
def form_valid(self, form):
"""
Create membership, check that all is good, make transactions