Update group roles view to the new AddRemoveView

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2019-04-24 22:23:15 -04:00
parent a556f2a1ba
commit 52f734ee9f
6 changed files with 47 additions and 29 deletions

View File

@@ -0,0 +1,23 @@
from __future__ import unicode_literals
from django.db import transaction
from mayan.apps.user_management.events import event_group_edited
def method_group_roles_add(self, queryset, _user):
with transaction.atomic():
event_group_edited.commit(
actor=_user, target=self
)
for role in queryset:
self.roles.add(role)
def method_group_roles_remove(self, queryset, _user):
with transaction.atomic():
event_group_edited.commit(
actor=_user, target=self
)
for role in queryset:
self.roles.remove(role)