Example #1
0
def list_sales():
    if session.get('logged_in'):
        return redirect('/sales_logged_in')
    sales = Sale.all()
    images = {}
    for sale in sales:
        directory = os.listdir(sale.file_path)
        file_path = sale.file_path
        images.update({file_path: directory[0]})
    return render_template('sales.html', sales=sales, images=images)
Example #2
0
def sales_logged_in():
    sales = Sale.all()
    images = {}
    for sale in sales:
        directory = os.listdir(sale.file_path)
        file_path = sale.file_path
        images.update({file_path: directory[0]})
    return render_template('sales_logged_in.html',
                           sales=sales,
                           username=User.find_by_id(session['USERNAME']),
                           images=images,
                           file_path=file_path)