Exemplo n.º 1
0
def items_all():
    if current_user.role != "ADMIN":
        return render_template("index.html", msg=msg_admin_feature)
    categoryNames = Category.find_all_category_names()
    listnames = List.find_all_list_names()
    items = Item.query.all()
    return render_template("items/all.html", items = items, categoryNames = categoryNames, listnames = listnames)
Exemplo n.º 2
0
def list_page(list_id):
    list = List.query.get_or_404(list_id)
    if current_user.id != list.account_id:
        return render_template("index.html", msg=msg_other_user)
    categoryNames = Category.find_all_category_names()
    items = List.find_items_by_list(list_id)
    return render_template("/lists/info.html",
                           list=List.query.get(list_id),
                           items=items,
                           categoryNames=categoryNames)
Exemplo n.º 3
0
def item(item_id):
    item = Item.query.get_or_404(item_id)
    if current_user.id != item.account_id:
        return render_template("index.html", msg=msg_other_user)

    lists = List.find_all_lists_by_id(current_user.id)
    categories = Category.query.all()
    categoryNames = Category.find_all_category_names()
    listnames = List.find_all_lists_by_id_dictionary(current_user.id)
    return render_template("items/edit.html", item = item, lists = lists, categories = categories, categoryNames = categoryNames, listnames = listnames, aform = AmountForm())
Exemplo n.º 4
0
def items_index():
    categoryNames = Category.find_all_category_names()
    listnames = List.find_all_lists_by_id_dictionary(current_user.id)
    items = Item.find_all_items_by_id(current_user.id)
    return render_template("items/list.html", items = items, categoryNames = categoryNames, listnames = listnames)