Browse Source

Add transaction atomic no endpoint create

pull/3822/head
LeandroJatai 1 week ago
parent
commit
0cc097f4d1
  1. 2
      sapl/api/views_materia.py

2
sapl/api/views_materia.py

@ -1,6 +1,7 @@
from copy import deepcopy from copy import deepcopy
from django.apps.registry import apps from django.apps.registry import apps
from django.db import transaction
from django.db.models import Q from django.db.models import Q
from rest_framework.decorators import action from rest_framework.decorators import action
from rest_framework.status import HTTP_201_CREATED from rest_framework.status import HTTP_201_CREATED
@ -92,6 +93,7 @@ class _MateriaLegislativaViewSet:
class Meta: class Meta:
ordering = ['-ano', 'tipo', 'numero'] ordering = ['-ano', 'tipo', 'numero']
@transaction.atomic
def create(self, request, *args, **kwargs): def create(self, request, *args, **kwargs):
data = deepcopy(request.data) data = deepcopy(request.data)
tipo = data.get('tipo', None) tipo = data.get('tipo', None)

Loading…
Cancel
Save