Exemplo n.º 1
0
def delete_telephone_by_id(address_book_id, contact_id, telephone_id):
    session = Session()

    telephone = session.query(Telephone) \
        .filter(Telephone.id == telephone_id) \
        .first()

    session.delete(telephone)
    session.commit()

    return redirect('/addressBooks/{}/contacts/{}'.format(address_book_id, contact_id))
Exemplo n.º 2
0
def delete_address_by_id(address_book_id, contact_id, address_id):
    session = Session()

    address = session.query(Address) \
        .filter(Address.id == address_id) \
        .first()

    session.delete(address)
    session.commit()

    return redirect('/addressBooks/{}/contacts/{}'.format(
        address_book_id, contact_id))
Exemplo n.º 3
0
def delete_contact_by_id(address_book_id, id):
    session = Session()

    contact = session.query(Contact) \
        .join(AddressBook) \
        .filter(AddressBook.id == address_book_id) \
        .filter(Contact.id == id) \
        .first()

    session.delete(contact)
    session.commit()

    return redirect('/addressBooks/{}'.format(address_book_id))