Ejemplo n.º 1
0
def remover(id):
    from services.solicitacao_matricula_service import listar as listar_solicitacao_matriculas
    solicitacao_matriculas = to_dict_list(listar_solicitacao_matriculas())
    for solicitacao in solicitacao_matriculas:
        if solicitacao['id_aluno'] == id:
            return 'Aluno já foi atrelado a uma ou mais matérias. Exclusão não permitida.', 409
        
    removido = service_remover(id)
    if removido != None:
        return jsonify(to_dict(removido))
    return '', 404
Ejemplo n.º 2
0
def remover_aluno_site():
    id = request.form["id"]
    if id == None:
        return render_template(
            "index.html",
            alunos=service_listar(),
            mensagem=mensagem_inicial,
            mensagem_remover="Informe um Id válido para remover um aluno! " +
            mensagem_remover)
    removido = service_remover(id)
    if removido == 1:
        return render_template("index.html",
                               alunos=service_listar(),
                               mensagem=mensagem_inicial,
                               mensagem_remover="Aluno removido! " +
                               mensagem_remover)
    return render_template(
        "index.html",
        alunos=service_listar(),
        mensagem=mensagem_inicial,
        mensagem_remover=
        f"Não foi possível remover o aluno de id: {id}. {mensagem_remover}")
Ejemplo n.º 3
0
def remover_aluno(id):
    removido = service_remover(id)
    if removido == 1:
        return jsonify(removido), 202
    return jsonify({'erro': 'aluno nao encontrado'}), 400