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'))
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))
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))
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'))
def homepage(): items = showAllItems(True) log = checkLogin() return render_template('homepage.html', items=items, log=log)