Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
def get_default_success_url(self) -> str:
pk = self.object.groups.first().pk
return reverse("assigned_group_roles", args=[pk])
def get(self, request, *args, **kwargs):
self.object = self.get_object()
if not self.object.date_end:
self.object.date_end = timezone.now().date()
self.object.save()
messages.success(request, _("The group role assignment has been stopped."))
return redirect(self.get_success_url())
@method_decorator(never_cache, "dispatch")
class GroupRoleAssignmentDeleteView(
PermissionRequiredMixin, RevisionMixin, SuccessNextMixin, AdvancedDeleteView
):
"""Delete view for group role assignments."""
model = GroupRoleAssignment
permission_required = "alsijil.delete_grouproleassignment"
template_name = "core/pages/delete.html"
success_message = _("The group role assignment has been deleted.")
def get_default_success_url(self) -> str:
pk = self.object.groups.first().pk
return reverse("assigned_group_roles", args=[pk])