Add database transaction handling
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import logging
|
|||||||
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.core.exceptions import PermissionDenied
|
from django.core.exceptions import PermissionDenied
|
||||||
|
from django.db import transaction
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
from django.urls import reverse, reverse_lazy
|
from django.urls import reverse, reverse_lazy
|
||||||
@@ -47,6 +48,7 @@ class DocumentTypeSmartLinksView(AddRemoveView):
|
|||||||
related_field = 'smart_links'
|
related_field = 'smart_links'
|
||||||
|
|
||||||
def action_add(self, queryset, _user):
|
def action_add(self, queryset, _user):
|
||||||
|
with transaction.atomic():
|
||||||
event_document_type_edited.commit(
|
event_document_type_edited.commit(
|
||||||
actor=_user, target=self.main_object
|
actor=_user, target=self.main_object
|
||||||
)
|
)
|
||||||
@@ -57,6 +59,7 @@ class DocumentTypeSmartLinksView(AddRemoveView):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def action_remove(self, queryset, _user):
|
def action_remove(self, queryset, _user):
|
||||||
|
with transaction.atomic():
|
||||||
event_document_type_edited.commit(
|
event_document_type_edited.commit(
|
||||||
actor=_user, target=self.main_object
|
actor=_user, target=self.main_object
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user