Exemplo n.º 1
0
def search_results(search):
    results = []
    search_string = search.data['search']

    if search_string:
        if search.data['select'] == 'Artist':
            qry = db_session.query(
                Album, Artist).filter(Artist.id == Album.artist_id).filter(
                    Artist.name.contains(search_string))
            results = [item[0] for item in qry.all()]
        elif search.data['select'] == 'Album':
            qry = db_session.query(Album).filter(
                Album.title.contains(search_string))
            results = qry.all()
        elif search.data['select'] == 'Publisher':
            qry = db_session.query(Album).filter(
                Album.publisher.contains(search_string))
            results = qry.all()
        else:
            qry = db_session.query(Album)
            results = qry.all()
    else:
        qry = db_session.query(Album)
        results = qry.all()

    if not results:
        flash('No results found!')
        return redirect('/')
    else:
        # display results
        table = Results(results)
        table.border = True
        return render_template('results.html', table=table)
Exemplo n.º 2
0
def selectTableType(qry):
    if session['level'] == 'Admin':
        return Results(qry)
    elif session['level'] == 'Editor':
        return ReadEdit(qry)
    else:
        return ReadOnly(qry)
Exemplo n.º 3
0
def search_results(search):
    results = []
    search_string = search.data['search']
 
    if search_string:
        if search.data['select'] == 'Points':
            qry = db_session.query(Point, ).filter(
                .id==Point._id).filter(
                    .name.contains(search_string))
            results = [item[0] for item in qry.all()]
        elif search.data['select'] == 'Points':
            qry = db_session.query(Point).filter(
                Point.title.contains(search_string))
            results = qry.all()
        else:
            qry = db_session.query(Point)
            results = qry.all()
    else:
        qry = db_session.query(Point)
        results = qry.all()
 
    if not results:
        return redirect('/')
    else:
        # display results
        table = Results(results)
        table.border = True
        return render_template('results.html', table=table)
Exemplo n.º 4
0
def weld():
    flash('WELD')
    qry = db_session.query(Schedule).filter(
        Schedule.machine_center == 'WELD').filter(Schedule.archived == 0)
    table = Results(qry)
    table.border = True
    return render_template('search.html', table=table)
Exemplo n.º 5
0
def search_results(search):
    results = []
    search_string = search.data['search']

    if search_string:
        
        if search.data['select'] == 'Blue':
            qry = db_session.query(BlueScores).filter(BlueScores.username.contains(search_string))
            results = qry.all()
        elif search.data['select'] == 'Red':
            qry = db_session.query(RedScores).filter(RedScores.username.contains(search_string))
            results = qry.all()
        elif search.data['select'] == 'All':
            q1 = db_session.query(RedScores).filter(RedScores.username.contains(search_string))
            q2 = db_session.query(BlueScores).filter(BlueScores.username.contains(search_string))
            qry = q1.union_all(q2)
            results = qry.all()
        else:
            qry = db_session.query(Userdata)
            results = qry.all()
    else:
        q1 = db_session.query(BlueScores)
        q2 = db_session.query(RedScores)
        qry = q1.union_all(q2)

        results = qry.all()

    if not results:
        flash('No results found!')
        return redirect('/search')
    else:
        table = Results(results)
        table.border = True
        return render_template('results.html', table=table)
Exemplo n.º 6
0
def search_results(search):
    results = []
    search_string = search.data['search']

    if search_string:
        if search.data['select'] == 'Version':
            qry = db_session.query(EnvironmentRequest).filter(
                EnvironmentRequest.version.contains(search_string))
            results = qry.all()
        elif search.data['select'] == 'Environment Number':
            qry = db_session.query(EnvironmentRequest).join(
                Environment).filter(Environment.number == int(search_string))
            results = qry.all()
    else:
        qry = db_session.query(EnvironmentRequest)
        results = qry.all()

    if not results:
        flash('No results found!')
        return redirect('/')
    else:
        # display results
        table = Results(results)
        table.border = True
        return render_template('results.html', table=table)
Exemplo n.º 7
0
def search_results(search):
    results = []
    search_string = search.data['search']

    if search_string:
        if search.data['select'] == 'Especie':
            qry = db_session.query(Info, Especie).filter(
                Especie.id==Info.especie_id).filter(
                    Especie.name.contains(search_string))
            results = [item[0] for item in qry.all()]
        elif search.data['select'] == 'Info':
            qry = db_session.query(Info).filter(
                Info.nombre_cadena.contains(search_string))
            results = qry.all()
        elif search.data['select'] == 'Accesion':
            qry = db_session.query(Info).filter(
                Info.accesion.contains(search_string))
            results = qry.all()
        else:
            qry = db_session.query(Info)
            results = qry.all()
    else:
        qry = db_session.query(Info)
        results = qry.all()

    if not results:
        flash('No results found!')
        return redirect('/')
    else:
        # display results
        table = Results(results)
        print(results)

        table.border = True
        return render_template('results.html', table=table)
Exemplo n.º 8
0
def search_results(search):
    search_string = search.data['search']

    if search_string:
        if search.data['select'] == 'Description':
            qry = db_session.query(Location).filter(
                Location.description.contains(search_string))
            results = qry.all()
        elif search.data['select'] == 'Shortname':
            qry = db_session.query(Location).filter(
                Location.shortname.contains(search_string))
            results = qry.all()
        elif search.data['select'] == 'Instrument_id':
            qry = db_session.query(Location).filter(
                Location.instrument_id.contains(search_string))
            results = qry.all()
        elif search.data['select'] == 'Status':
            qry = db_session.query(Location).filter(
                Location.status.contains(search_string))
            results = qry.all()
        else:
            qry = db_session.query(Location)
            results = qry.all()
    else:
        qry = db_session.query(Location)
        results = qry.all()

    if not results:
        flash('No results found!')
        return redirect('/')
    else:
        # display results
        table = Results(results)
        table.border = True
        return render_template('results.html', table=table)
Exemplo n.º 9
0
def search_results(search):
    results = []
    search_string = search.data['search']

    if search_string:
        if search.data['select'] == 'Tweets':
            qry = db_session.query(Tweets).filter(
                Tweets.id).filter(
                    Tweets.text.contains(search_string))
            results = qry.all()
        elif search.data['select'] == 'Speeches':
            qry = db_session.query(Speeches).filter(
                Speeches.text.contains(search_string))
            results = qry.all()
        elif search.data['select'] == 'Interviews':
            qry = db_session.query(Interviews).filter(
                Interviews.text.contains(search_string))
            results = qry.all()
        elif search.data['select'] == 'AllAbove':
            qry = db_session.query(Tweets, Speeches, Interviews).filter(
                Interviews.text.contains(search_string))
            results = qry.all()
    else:
        qry = db_session.query(Album)
        results = qry.all()

    if not results:
        flash('No results found!')
        return redirect('/')
    else:
        # display results
        table = Results(results)
        table.border = True
        return render_template('results.html', table=table)
Exemplo n.º 10
0
def search_results(search):
    results = []
    search_string = search.data['search']

    if search_string:

        if search.data['select'] == 'Username':
            qry = db_session.query(Userdata).filter(
                Userdata.username.contains(search_string))
            results = qry.all()
        elif search.data['select'] == 'User_id':
            qry = db_session.query(Userdata).filter(
                Userdata.user_id.contains(search_string))
            results = qry.all()
        else:
            qry = db_session.query(Userdata)
            results = qry.all()
    else:
        qry = db_session.query(Userdata)
        results = qry.all()

    if not results:
        flash('No results found!')
        return redirect('/')
    else:
        table = Results(results)
        table.border = True
        return render_template('results.html', table=table)
Exemplo n.º 11
0
def search_results(search):
    results = []
    search_string = search.data['search']

    if search_string:
        if search.data['select'] == 'Item':
            qry = db_session.query(Store, Item).filter(
                Item.id==Store.item_id).filter(
                    Item.name.contains(search_string))
            results = [item[0] for item in qry.all()]
        elif search.data['select'] == 'Store':
            qry = db_session.query(Store).filter(
                Store.store_name.contains(search_string))
            results = qry.all()
        elif search.data['select'] == 'Date_to_purchase':
            qry = db_session.query(Store).filter(
                Store.date_to_purchase.contains(search_string))
            results = qry.all()
        else:
            qry = db_session.query(Store)
            results = qry.all()
    else:
        qry = db_session.query(Store)
        results = qry.all()
    if not results:
        flash('No results found!')
        return redirect('/')
    else:
        # display results
        table = Results(results)
        table.border = True
        return render_template('results.html', table=table)
Exemplo n.º 12
0
def search_results(search):
    results = []
    search_string = search.data['search']

    if search_string:
        if search.data['select'] == 'Academic':
            qry = db_session.query(
                Biography,
                Academic).filter(Academic.id == Biography.academics_id).filter(
                    Academic.name.contains(search_string))
            results = [item[0] for item in qry.all()]
        elif search.data['select'] == 'Biography':
            qry = db_session.query(Biography).filter(
                Biography.title.contains(search_string))
            results = qry.all()
        elif search.data['select'] == 'Publisher':
            qry = db_session.query(Biography).filter(
                Biography.publisher.contains(search_string))
            results = qry.all()
        else:
            qry = db_session.query(Biography)
            results = qry.all()
    else:
        qry = db_session.query(Biography)
        results = qry.all()

    if not results:
        flash('No results found!')
        return redirect('/')
    else:
        # display results
        table = Results(results)
        table.border = True
        return render_template('results.html', table=table)
Exemplo n.º 13
0
def full():
    qry = Work.query.join(association).join(
        Author).filter((association.c.work_id == Work.id)
                       & (association.c.author_id == Author.id))
    results = qry.all()
    table = Results(results)
    table.border = True
    return render_template('results.html', table=table)
Exemplo n.º 14
0
def buy_gift():
    with open('catalog.json') as json_file:
        results = json.load(json_file)
    table = Results(results)
    table.border = True
    return render_template('buy_gift.html',
                           the_title='Purchase Gift',
                           table=table)
Exemplo n.º 15
0
def gift_list():
    with open('catalog.json') as json_file:
        results = json.load(json_file)
    table = Results(results)
    table.border = True
    return render_template('gift_list.html',
                           the_title='Gift List',
                           table=table)
Exemplo n.º 16
0
def success():
    qry = db_session.query(Items)
    results = qry.all()
    results_list = [[item.id, item.name, item.quantity, item.description] for item in results]
    print(tabulate(results_list, headers=['Id', 'Name', 'Qty', 'Descr'], tablefmt='orgtbl'))
    #return str(results)
    table = Results(results)
    table.border = True
    return render_template('results.html', table=table)
Exemplo n.º 17
0
def index():
    search = GameForm(request.form)

    if request.method == "POST":
        return search_results(search)

    games = Games.get_all_games()
    table = Results(games)
    return flask.render_template("index.html", form=search, table=table)
Exemplo n.º 18
0
def show_users():
    try:
        cursor.execute("SELECT * FROM users")
        rows = cursor.fetchall()
        table = Results(rows)
        table.border = True
        return render_template('users.html', table=table)
    except Exception as e:
        print(e)
Exemplo n.º 19
0
def show_devices():
    results = []
    qry = db_session.query(Device)
    results = qry.all()
    table = Results(results)
    table.border = True
    return render_template('results.html',
                           table=table,
                           form='new_device',
                           item='device')
Exemplo n.º 20
0
def progress_render():
    # query = db_session.query(user_info)
    USER_ID = current_user.id
    results = user_info.query.filter(user_info.user_id_helper == USER_ID)
    # results = query.all()
    print('Hueg', results)
    table = Results(results, classes=['yellowTable'])
    table.border = True

    return render_template('pages/lk/progress.html', table=table)
Exemplo n.º 21
0
def userlist():
    cur = mysql.connection.cursor()
    cur.execute("SELECT * FROM Employee")
    rows = cur.fetchall()
    messages = rows
    print('Total Row(s):', cur.rowcount)
    for row in rows:
        print(row)
    table = Results(rows)
    table.border = True
    cur.close()
    return render_template('users.html', table=table)
Exemplo n.º 22
0
def words():
	try:
		conn = mysql.connect()
		cursor = conn.cursor(pymysql.cursors.DictCursor)
		cursor.execute("SELECT * FROM words1")
		rows = cursor.fetchall()
		table = Results(rows)
		table.border = True
		#return (' ok')
		return render_template('words.html', table=table)
	except Exception as e:
		print(e)
		return ('not ok')
def users():
    try:
        conn = mysql.connect()
        cursor = conn.cursor(pymysql.cursors.DictCursor)
        cursor.execute("SELECT * FROM tbl_user")
        rows = cursor.fetchall()
        table = Results(rows)
        table.border = True
        return render_template('users.html', table=table)
    except Exception as e:
        print(e)
    finally:
        cursor.close()
        conn.close()
Exemplo n.º 24
0
def ViewProductMovement():
    productMovement = mongo.db.productMovement
    output = []
    for all_product in productMovement.find():
        output.append({
            "ProductName": all_product['ProductName'],
            "FromLocation": all_product['FromLocation'],
            "ToLocation": all_product['ToLocation'],
            "qty": all_product['qty'],
            "timestamp": all_product['timestamp']
        })
    table = Results(output)
    table.border = True
    return render_template('result.html', table=table)
Exemplo n.º 25
0
def search_results(search):
    results = []
    search_string = search.data['search']

    if search_string:
        if search.data['select'] == 'Album':
            qry = db_session.query(Album).filter(
                Album.name.contains(search_string))
            results = qry.all()
            table = Results(results)
        elif search.data['select'] == 'Movie':
            qry = Movie.query.filter(Movie.title.contains(search_string))
            results = qry.all()
            table = ResultsMov(results)
        elif search.data['select'] == 'Track':
            qry = Track.query.filter(Track.name.contains(search_string))
            results = qry.all()
            table = ResultsTrack(results)
        elif search.data['select'] == 'Track':
            qry = Track.query.filter(Track.name.contains(search_string))
            results = qry.all()
            table = ResultsTrack(results)
        elif search.data['select'] == 'Artist':
            qry = Artist.query.filter(Artist.name.contains(search_string))
            results = qry.all()
            table = ResultsArtist(results)
        elif search.data['select'] == 'Actor':
            qry = Actor.query.filter(Actor.name.contains(search_string))
            results = qry.all()
            table = ResultsActor(results)
        elif search.data['select'] == 'Director':
            qry = Director.query.filter(Director.name.contains(search_string))
            results = qry.all()
            table = ResultsDirector(results)
        else:
            flash('No results found!')
            return redirect('/search')
    else:
        flash('Please fill the fields')
        return redirect('/search')

    if not results:
        flash('No results found wrong input!')
        return redirect('/search')
    else:
        # display results
        table.border = True
        return render_template('results.html', table=table)
Exemplo n.º 26
0
def search_results(search):
    results = []
    select_string = search.data['select']
    search_string = search.data['search']
    sql_table = select_string
    sql_col = ''

    if search.data['search'] == '':
        flash('Empty search. Please try again!')
        return redirect('/search')

    if select_string == 'Users':
        sql_table == 'users'
        sql_col = 'userId'
    elif select_string == 'Day Weather':
        sql_table == 'weatherDaily'
        sql_col = 'dayId'
    elif select_string == 'Observations':
        sql_table == 'observations'
        sql_col = 'groupId'
    else:
        sql_table == 'files'
        sql_col = 'fileId'

    query = "SELECT * FROM " + sql_table + " WHERE " + sql_col + " LIKE '%" + search_string + "%'"
    cursor.execute(query)
    results = cursor.fetchall()
    if not results:
        flash('No results found!')
        return redirect('/search')
    else:
        # display results
        print("WORKED table =")
        if select_string == 'Users':
            print("table = RESULTS")
            table = Results(results)
        elif select_string == 'Observations':
            print("table = RESULTS OBS")
            table = ResultsObs(results)
        elif select_string == 'Day Weather':
            print("table = RESULTS WD")
            table = ResultsWD(results)
        else:
            print("table = RESULTS FILE")
            table = ResultsFile(results)

        table.border = True
        return render_template('results.html', table=table)
Exemplo n.º 27
0
def search_results(search):
    results = []
    search_string = search.data['search']
    print(search_string)

    qry = db_session.query(Hotels)
    results = qry.filter_by(hsr_layout=search_string).all()

    if not results:
        flash('No results found!')
        return redirect('/')
    else:
        # display results
        table = Results(results)
        table.border = True
        return render_template('results.html', table=table)
Exemplo n.º 28
0
def search_results(search):
    results = []
    search_string = search.data['search']
    if search_string:
        qry = db_session.query(Product).filter(
            Product.name.contains(search_string))
        results = qry.all()

    if not results:
        flash('No results found!')
        return redirect('/')
    else:
        # display results
        table = Results(results)
        table.border = True
        return render_template('results.html', table=table)
Exemplo n.º 29
0
def search_results(search):
    results = []
    search_string = search.data['search']

    if search.data['search'] == '':
        qry = db_session.query(Album)
        results = qry.all()

    if not results:
        flash('No results found!')
        return redirect('/')
    else:
        # display results
        table = Results(results)
        table.border = True
        return render_template('results.html', table=table)
Exemplo n.º 30
0
def search_results():
    results = []
    #search_string = search.data['search']

    abc = ''
    if abc == '':  #search.data['search'] == '':
        #db.session.
        qry = db.session.query(ProductRequest)
        results = qry.all()

    if not results:
        flash('No results found!')
        return redirect('/')
    else:
        # display results
        table = Results(results)
        table.border = True
        return render_template('results.html', table=table)