(request, user_id, group_name)
return render(request, 'user_management/user_delete_confirm.html', context)
Delete particular user with given group name.
Delete particular user with given group name.
Delete particular user with given group name .
def delete_user_in_group(request, user_id, group_name):
    """
        Delete particular user with given group name.
    """

    target_user = get_object_or_404(LinkUser, id=user_id)

    context = {'target_user': target_user,
               'action': 'deactivate' if target_user.is_confirmed else 'delete',
               'this_page': f'users_{group_name}s'}

    if request.method == 'POST':
        if target_user.is_confirmed:
            target_user.is_active = False
            target_user.organizations.clear()
            target_user.registrar = None
            target_user.save()
        else:
            target_user.delete()

        return HttpResponseRedirect(reverse(f'user_management_manage_{group_name}'))

    return render(request, 'user_management/user_delete_confirm.html', context)
def delete_user_in_group ( request , user_id , group_name ) : target_user = get_object_or_404 ( LinkUser , id = user_id ) context = { 'target_user' : target_user , 'action' : 'deactivate' if target_user . is_confirmed else 'delete' , 'this_page' : f'users_{group_name}s' } if request . method == 'POST' : if target_user . is_confirmed : target_user . is_active = False target_user . organizations . clear ( ) target_user . registrar = None target_user . save ( ) else : target_user . delete ( ) return HttpResponseRedirect ( reverse ( f'user_management_manage_{group_name}' ) ) return render ( request , 'user_management/user_delete_confirm.html' , context )