Ejemplo n.º 1
0
def category_items(category):
    try:
        category_item = session.query(Category).filter_by(name=category).one()
        items = session.query(Item).filter_by(category=category_item)
        return render_template('category_items.html', categories=get_all_categories(), items=items, curr_cat=category,
                               login_state=user_logged_in())
    except NoResultFound:
        return redirect(url_for('index'))
Ejemplo n.º 2
0
def category_items(category):
    try:
        category_item = session.query(Category).filter_by(name=category).one()
        items = session.query(Item).filter_by(category=category_item)
        return render_template('category_items.html',
                               categories=get_all_categories(),
                               items=items,
                               curr_cat=category,
                               login_state=user_logged_in())
    except NoResultFound:
        return redirect(url_for('index'))
Ejemplo n.º 3
0
def index():
    items = session.query(Item).order_by(desc(Item.created_date))
    return render_template('index.html',
                           categories=get_all_categories(),
                           items=items,
                           login_state=user_logged_in())
Ejemplo n.º 4
0
def index():
    items = session.query(Item).order_by(desc(Item.created_date))
    return render_template('index.html', categories=get_all_categories(), items=items, login_state=user_logged_in())