Ejemplo n.º 1
0
def newItem():
    if checkLogin():
        catagories = session.query(Catagory).all()
        if request.method == 'GET':
            return render_template('newitem.html', catagories=catagories)
        if request.method == 'POST':
            new_item = crud_create()
            return redirect(url_for('viewAll_owner', owner=new_item.owner))
    else:
        return redirect(url_for('auth.login'))
Ejemplo n.º 2
0
def deleteItem(item_name):
    item = sqlItemSearch('name', item_name)
    if checkLogin(True, item):
        if request.method == 'GET':
            return render_template('deleteitem.html', item=item)
        if request.method == 'POST':
            crud_delete(item)
            return redirect(url_for('viewAll_catagory',
                                    catagory=item.catagory))
    else:
        return redirect(url_for('viewAll_catagory', catagory=item.catagory))
Ejemplo n.º 3
0
def editItem(item_name):
    item = sqlItemSearch('name', item_name)
    if checkLogin(True, item):
        catagories = session.query(Catagory).all()
        if request.method == 'GET':
            return render_template('edititem.html',
                                   item=item, catagories=catagories)
        if request.method == 'POST':
            crud_edit(item)
            return redirect(url_for('viewAll_owner', owner=item.owner))
    else:
        return redirect(url_for('viewAll_owner', owner=item.owner))
Ejemplo n.º 4
0
def viewAll_owner(owner):
    items = sqlItemSearch('owner', owner.capitalize())
    if request.method == 'GET' and checkLogin():
        return render_template('viewowner.html', owner=owner, items=items)
    else:
        return redirect(url_for('homepage'))
Ejemplo n.º 5
0
def homepage():
    items = showAllItems(True)
    log = checkLogin()
    return render_template('homepage.html', items=items, log=log)