Merge branch 'transactify' into 'master'

Make review changes atomic

See merge request !22
This commit is contained in:
James Polley 2017-08-09 03:59:33 +00:00
commit c93fa5d812

View file

@ -4,6 +4,7 @@ import random
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.core.mail import send_mass_mail from django.core.mail import send_mass_mail
from django.db import transaction
from django.db.models import Q from django.db.models import Q
from django.http import HttpResponse from django.http import HttpResponse
from django.http import HttpResponseBadRequest, HttpResponseNotAllowed from django.http import HttpResponseBadRequest, HttpResponseNotAllowed
@ -325,6 +326,7 @@ def review_admin(request, section_slug):
# FIXME: This view is too complex according to flake8 # FIXME: This view is too complex according to flake8
@login_required @login_required
@transaction.atomic
def review_detail(request, pk): def review_detail(request, pk):
proposals = ProposalBase.objects.select_related("result").select_subclasses() proposals = ProposalBase.objects.select_related("result").select_subclasses()
@ -451,6 +453,7 @@ def review_detail(request, pk):
@login_required @login_required
@require_POST @require_POST
@transaction.atomic
def review_delete(request, pk): def review_delete(request, pk):
review = get_object_or_404(Review, pk=pk) review = get_object_or_404(Review, pk=pk)
section_slug = review.section section_slug = review.section