def delete_shoppinglist(_id): Data.delete_dictionary(_id, Data.shoppinglists) all_items = Data.get_the_data(_id, Data.items) if all_items is not None: for item in all_items: if item['_id'] in Data.items: Data.delete_dictionary(item['_id'], Data.items) flash('Shopping list deleted') return redirect(url_for('dashboard'))
def delete_item(_id): index_ = Data.get_index(_id, Data.items) sh_id = Data.items[index_]['owner_id'] Data.delete_dictionary(_id, Data.items) flash('Item deleted') return redirect(url_for('shoppinglist_items', _id=sh_id))