From fd4d5881323aa8652d2fafef9bdc3db157ecf97f Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Wed, 10 Jul 2019 13:26:01 -0300 Subject: [PATCH] Adiciona @transaction.atomic em form_valid de protocolo --- sapl/protocoloadm/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sapl/protocoloadm/views.py b/sapl/protocoloadm/views.py index 775cb13f8..961f74c27 100755 --- a/sapl/protocoloadm/views.py +++ b/sapl/protocoloadm/views.py @@ -11,6 +11,7 @@ from django.contrib.auth.mixins import PermissionRequiredMixin from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import reverse +from django.db import transaction from django.db.models import Max, Q from django.http import Http404, HttpResponse, JsonResponse from django.http.response import HttpResponseRedirect @@ -539,6 +540,7 @@ class ProtocoloDocumentoView(PermissionRequiredMixin, initial['hora'] = timezone.localtime(timezone.now()) return initial + @transaction.atomic def form_valid(self, form): protocolo = form.save(commit=False) username = self.request.user.username @@ -726,6 +728,7 @@ class ProtocoloMateriaView(PermissionRequiredMixin, CreateView): initial['hora'] = timezone.localtime(timezone.now()) return initial + @transaction.atomic def form_valid(self, form): protocolo = form.save(commit=False) username = self.request.user.username @@ -983,7 +986,7 @@ class DocumentoAnexadoEmLoteView(PermissionRequiredMixin, FilterView): def get_context_data(self, **kwargs): context = super( - DocumentoAnexadoEmLoteView,self + DocumentoAnexadoEmLoteView, self ).get_context_data(**kwargs) context['root_pk'] = self.kwargs['pk']