Exemplo n.º 1
0
def shoppinglist_items(_id):
    form = ShoppingitemForm()
    title = "Items"
    shopping_list = Data.get_the_data(_id, Data.shoppinglists)
    items = Data.get_the_data(_id, Data.items)
    notify = 'You have no items in this shopping list yet'
    return render_template('list_items.html',
                           items=items,
                           notify=notify,
                           shopping_list=shopping_list,
                           form=form,
                           title=title)
Exemplo n.º 2
0
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'))
Exemplo n.º 3
0
def dashboard():
    form = Shoppinglist_nameForm()
    title = "Dashboard"
    shopping_lists = Data.get_the_data(session['id'], Data.shoppinglists)
    notify = 'You have no shopping lists yet!'
    return render_template('dashboard.html',
                           shopping_lists=shopping_lists,
                           notify=notify,
                           username=session['username'],
                           form=form,
                           title=title)