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)
def search_results(search): results = [] search_string = search.data['search'] if search_string: if search.data['select'] == 'Artist': qry = db_session.query( Song, Artist).filter(Artist.id == Song.artist_id).filter( Artist.name.contains(search_string)) results = [item[0] for item in qry.all()] elif search.data['select'] == 'Song': qry = db_session.query(Song).filter( Song.title.contains(search_string)) results = qry.all() else: qry = db_session.query(Song) results = qry.all() else: qry = db_session.query(Song) results = qry.all() if not results: flash('No results found!') return redirect('/search') else: # display results table = Results(results) table.border = True return render_template('results.html', table=table)
def nmlg(): flash('NMLG') qry = db_session.query(Schedule).filter( Schedule.machine_center == 'NMLG').filter(Schedule.archived == 0) table = Results(qry) table.border = True return render_template('search.html', table=table)
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)
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)
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)
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)
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)
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)
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')
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)
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()
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)
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)
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)
def selectTableType(qry): if session['level'] == 'Admin': return Results(qry) elif session['level'] == 'Editor': return ReadEdit(qry) else: return ReadOnly(qry)
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)
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)
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)
def search_results(search): results = [] qry = db_session.query(Master).filter( Master.product.contains(search.data['product_select']), Master.shape.contains(search.data['shape_select']), Master.container_type.contains(search.data['type_select']), Master.SKU.contains(search.data['sku_search'])) 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)
def search_results(search): results = [] data = get_all_data() search_string = search.data['search'] scores = rank_pages(data, search_string) results = [] for video in scores: vid_id = str(get_id_from_name(video)) results.append({ 'name': video, 'summary': get_summary(vid_id), 'url': get_url(vid_id) }) table = Results(results, html_attrs={'class': 'results_table'}) table.border = True return render_template('results.html', table=table, form=search)
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)
def search_results(search): results = [] search_string = search.data['search'] """ sort = request.args.get('sort', 'id') reverse = (request.args.get('direction', 'asc') == 'desc') """ if search_string: if search.data['select'] == 'Author': qry = db_session.query( Work, Author).filter(Author.id == Work.author_id).filter( Author.name.contains(search_string)) results = [item[0] for item in qry.all()] elif search.data['select'] == 'Work Title': qry = db_session.query(Work).filter( Work.title.contains(search_string)) results = qry.all() elif search.data['select'] == 'Department': qry = db_session.query(Work).filter( Work.department.contains(search_string)) results = qry.all() elif search.data['select'] == 'Publication Date': qry = db_session.query(Work).filter( Work.publication_date.contains(search_string)) results = qry.all() else: qry = db_session.query(Work) results = qry.all() else: qry = db_session.query(Work) 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)
def db_connect(): """This function is the first entry point of the app""" try: conn = mysql.connect() cursor = conn.cursor(pymysql.cursors.DictCursor) cursor.execute("SELECT * FROM tbl_client") rows = cursor.fetchall() table = Results(rows) table.border = True client_type = "your" return render_template('add.html', table=table, client_type=client_type) except Exception as e: dateTimeObj = datetime.now() print dateTimeObj logger.exception(e) finally: conn.close() cursor.close()
def users(): global df_summary, df_count, df_raw, df_filter, df_volt try: #get latest ts conn = mysql.connect() cursor = conn.cursor(pymysql.cursors.DictCursor) cursor.execute("SELECT max(ts) as tsupdate FROM data_counter ") ts = cursor.fetchone() df_summary, df_count, df_raw, df_filter, df_volt = evaluation.evaluate( ) summary = df_summary.to_dict('r') table = Results(summary) table.border = True return render_template( 'summary.html', table=table, tsupdate=ts['tsupdate']) #rows.to_html(index=False)) except Exception as e: print(e)
def index(): search = SearchCustomer(request.form) search_string = "" if request.method == 'POST': search_string = search.data['search'] #return search_results(search) results = [] if search_string: qry = db.session.query(customer).filter( or_(customer.firstname.contains(search_string), customer.lastname.contains(search_string))) results = qry.all() else: results = customer.query.all() table = Results(results) #table = results table.border = True return render_template('index.html', form=search, table=table)
def search_results(search): results = [] search_string = search.data['search'] if search_string: if search.data['select'] == 'SKU': str1 = search_string print(str1) qry = db_session.query( Price, SKU).filter(Price.item_number == SKU.item_number).filter( SKU.item_number.contains(search_string)) results = [item[0] for item in qry.all()] print(qry) #print(search_string) #print(Price.item_number.contains(search_string)) #elif search.data['select'] == 'Price': # qry = db_session.query(Price).filter( # Price.item_number.contains(search_string)) # results = qry.all() #pdb.set_trace() #elif search.data['select'] == 'Category': # qry = db_session.query(Style).filter( # Style.catalogue_category.contains(search_string)) # results = qry.all() else: qry = db_session.query(Price) results = qry.all() else: qry = db_session.query(Price) results = qry.all() if not results: flash('No results found!') return redirect('/') else: # display results redirect('/') table = Results(results) table.border = True #pdb.set_trace() return render_template('results.html', table=table)
def search_results(search): #search has the form from prev page results = [] search_string = search.data[ 'search'] #search_string contains tablet name user searches if search_string: qry = db_session.query(Tablets).filter( Tablets.tabletname.contains(search_string), Tablets.tabletquantity > 0) results = qry.all() if not results: flash('No tablet with such name found! OR tablet may be outstock!') return redirect('/') else: # display results table = Results(results) table.border = True return render_template( 'results.html', table=table) #results displayed in form of table
def search_results(search): results=[] search_string=search.data['search'] if search_string: if search.data['search']=='': query=db_session.query(Data) results=query.all() else: #filter based on user's search (can handle n-grams) query=db_session.query(Data).filter(Data.data.contains(search_string)) results = query.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)