Beispiel #1
0
 def get_context_data(self, **kwargs):
     user = self.get_object()
     key_block = self.key_prefix_block.format(user.username)
     groups = UserGroup.objects.exclude(id__in=self.object.groups.all())
     context = {
         'app': _('Users'),
         'action': _('User detail'),
         'groups': groups,
         'unblock': is_need_unblock(key_block),
         'can_update': CanUpdateDeleteUser.has_update_object_permission(
             self.request, self, user
         ),
         'can_delete': CanUpdateDeleteUser.has_delete_object_permission(
             self.request, self, user
         ),
     }
     kwargs.update(context)
     return super().get_context_data(**kwargs)
Beispiel #2
0
 def get_can_delete(self, obj):
     return CanUpdateDeleteUser.has_delete_object_permission(
         self.context['request'], self.context['view'], obj)