Example #1
0
def delete_full(id_recipe):
    for section in SectionDAOimpl.findByRecipe(id_recipe):
        InstructionDAOimpl.deleteBySection(section.id_sec)
        SectionDAOimpl.eraseAllMappingBySection(section.id_sec)
        SectionDAOimpl.deleteById(section.id_sec)
    for image in ImageDAOImpl.findByRecipe(id_recipe):
        ImageDAOImpl.deleteById(image.id_img)
    RecipeDAOimpl.eraseCategoryMapping(id_recipe)
    RecipeDAOimpl.eraseToolMapping(id_recipe)
    RecipeDAOimpl.deleteById(id_recipe)
Example #2
0
def read_by_recipe(id_recipe):
    sections = []
    for section in SectionDAOimpl.findByRecipe(id_recipe):
        sections.append(section.to_dict())
    json.dumps(sections)
    return sections