def delete_item(_id): """ deletes a bucketlist and its items""" index_ = Data.get_index(_id, Data.items) b_id = Data.items[index_]['owner_id'] Data.delete_dictionary(_id, Data.items) flash('Item deleted', 'Danger') return redirect(url_for('bucketlist_items', _id=b_id))
def delete_bucketlist(_id): """ deletes a bucketlist and its items""" Data.delete_dictionary(_id, Data.bucketlists) 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('Bucketlist deleted', 'Danger') return redirect(url_for('dashboard'))