Browse Source

Adiciona @transaction.atomic em form_valid de protocolo

pull/2894/head
Edward Ribeiro 6 years ago
committed by João
parent
commit
fd4d588132
  1. 5
      sapl/protocoloadm/views.py

5
sapl/protocoloadm/views.py

@ -11,6 +11,7 @@ from django.contrib.auth.mixins import PermissionRequiredMixin
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.db import transaction
from django.db.models import Max, Q from django.db.models import Max, Q
from django.http import Http404, HttpResponse, JsonResponse from django.http import Http404, HttpResponse, JsonResponse
from django.http.response import HttpResponseRedirect from django.http.response import HttpResponseRedirect
@ -539,6 +540,7 @@ class ProtocoloDocumentoView(PermissionRequiredMixin,
initial['hora'] = timezone.localtime(timezone.now()) initial['hora'] = timezone.localtime(timezone.now())
return initial return initial
@transaction.atomic
def form_valid(self, form): def form_valid(self, form):
protocolo = form.save(commit=False) protocolo = form.save(commit=False)
username = self.request.user.username username = self.request.user.username
@ -726,6 +728,7 @@ class ProtocoloMateriaView(PermissionRequiredMixin, CreateView):
initial['hora'] = timezone.localtime(timezone.now()) initial['hora'] = timezone.localtime(timezone.now())
return initial return initial
@transaction.atomic
def form_valid(self, form): def form_valid(self, form):
protocolo = form.save(commit=False) protocolo = form.save(commit=False)
username = self.request.user.username username = self.request.user.username
@ -983,7 +986,7 @@ class DocumentoAnexadoEmLoteView(PermissionRequiredMixin, FilterView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super( context = super(
DocumentoAnexadoEmLoteView,self DocumentoAnexadoEmLoteView, self
).get_context_data(**kwargs) ).get_context_data(**kwargs)
context['root_pk'] = self.kwargs['pk'] context['root_pk'] = self.kwargs['pk']

Loading…
Cancel
Save