'Manages selected users\' permissions for current object.'

def obj_perms_manage_user_view(self, request, object_pk, user_id):

    if (not self.has_change_permission(request, None)):
        post_url = reverse(u'admin:index', current_app=self.admin_site.name)
        return redirect(post_url)
    user = get_object_or_404(get_user_model(), pk=user_id)
    obj = get_object_or_404(self.get_queryset(request), pk=object_pk)
    form_class = self.get_obj_perms_manage_user_form(request)
    form = form_class(user, obj, (request.POST or None))
    if ((request.method == u'POST') and form.is_valid()):
        form.save_obj_perms()
        msg = ugettext(u'Permissions    saved.')
        messages.success(request, msg)
        info = (self.admin_site.name, self.model._meta.app_label, get_model_name(self.model))
        url = reverse((u'%s:%s_%s_permissions_manage_user' % info), args=[obj.pk, user.pk])
        return redirect(url)
    context = self.get_obj_perms_base_context(request, obj)
    context[u'user_obj'] = user
    context[u'user_perms'] = get_user_perms(user, obj)
    context[u'form'] = form
    request.current_app = self.admin_site.name
    if (django.VERSION >= (1, 10)):
        return render(request, self.get_obj_perms_manage_user_template(), context)
    return render_to_response(self.get_obj_perms_manage_user_template(), context, RequestContext(request))
