def latest(): views_all = Views.query.with_entities(Views.movieid).order_by( Views.views.desc()).limit(20).all() most_views = [i[0] for i in views_all] trending = Movies.query.filter( Movies.movieid.in_(most_views)).limit(20).all() new_movies = Movies.query.filter( Movies.release_year.in_(["2019", "2018", "2017"])).order_by( Movies.release_year.desc()).limit(20).all() likes_all = Likes.query.with_entities( Likes.movieid).filter_by(userid=current_user.userid).all() likes = [i[0] for i in likes_all] mylist_all = MyList.query.with_entities( MyList.movieid).filter_by(userid=current_user.userid).all() mylist = [i[0] for i in mylist_all] form = SearchForm() if form.validate_on_submit(): return redirect(url_for('search', search_text=form.search_field.data)) image_file = url_for('static', filename='profile_pics/' + current_user.image_file) return render_template('latest.html', title='Latest', image_file=image_file, form=form, trending=trending, likes=likes, mylist=mylist, new_movies=new_movies)
def history(): mylist_all = WatchHistory.query.with_entities( WatchHistory.movieid).filter_by(userid=current_user.userid).all() mylist = [i[0] for i in mylist_all] my_movies_history = Movies.query.filter(Movies.movieid.in_(mylist)).all() likes_all = Likes.query.with_entities( Likes.movieid).filter_by(userid=current_user.userid).all() likes = [i[0] for i in likes_all] mylist_all = MyList.query.with_entities( MyList.movieid).filter_by(userid=current_user.userid).all() mylist = [i[0] for i in mylist_all] form = SearchForm() if form.validate_on_submit(): return redirect(url_for('search', search_text=form.search_field.data)) image_file = url_for('static', filename='profile_pics/' + current_user.image_file) return render_template('myhistory.html', title='Watch History', form=form, image_file=image_file, history=my_movies_history, likes=likes, mylist=mylist)
def search(search_text): likes_all = Likes.query.with_entities( Likes.movieid).filter_by(userid=current_user.userid).all() likes = [i[0] for i in likes_all] mylist_all = MyList.query.with_entities( MyList.movieid).filter_by(userid=current_user.userid).all() mylist = [i[0] for i in mylist_all] x = query_index('movies', search_text, 1, 100) s = [i['_id'] for i in x] search_results = Movies.query.filter(Movies.movieid.in_(s)).all() form = SearchForm() if form.validate_on_submit(): return redirect(url_for('search', search_text=form.search_field.data)) image_file = url_for('static', filename='profile_pics/' + current_user.image_file) return render_template('search.html', title='Search Results', search_text=search_results, image_file=image_file, form=form, likes=likes, my_list=mylist)
def search(): from app.forms import SearchForm form = SearchForm() if form.validate_on_submit(): from app.models import BookTable bt = BookTable() search_query = "%" + str(form.search.data) + "%" books = bt.search_books(search_query) return render_template("search.html", form=form, count_books=len(books), books=books, searched=True) return render_template("search.html", form=form, count_books=0, books=[], searched=False)
def user(username): user = User.query.filter_by(username=username).first_or_404() page = request.args.get('page', 1, type=int) posts = user.posts.order_by(Post.timestamp.desc()).paginate( page, app.config['POSTS_PER_PAGE'], False) next_url = url_for('user', username=user.username, page=posts.next_num) \ if posts.has_next else None prev_url = url_for('user', username=user.username, page=posts.prev_num) \ if posts.has_prev else None form = SearchForm() if form.validate_on_submit(): username_search = request.form["search"] check_db = db.session.query( User.username).filter(User.username == username_search).scalar() if check_db == None: flash('Användaren finns inte!') return render_template('user.html', form=form, drop_down_cats=drop_down_cats, user=user, posts=posts.items, next_url=next_url, prev_url=prev_url) else: return redirect(url_for('user', username=username_search)) return render_template('user.html', form=form, drop_down_cats=drop_down_cats, user=user, posts=posts.items, next_url=next_url, prev_url=prev_url)
def search(): form = SearchForm() search_results = [] numMarketing = len( list(db.openings.find({"$text": { "$search": 'marketing' }}))) numEngineer = len( list(db.openings.find({"$text": { "$search": 'engineer' }}))) numSales = len(list(db.openings.find({"$text": {"$search": 'sales'}}))) if form.validate_on_submit(): search_results = list( db.openings.find({"$text": { "$search": form.search.data }})) num_results = len(search_results) return render_template('search_results.html', form=form, results=search_results[:10], start=0, end=10, page=1, total=2, q=form.search.data, num_results=num_results) return render_template('search.html', numMarketing=numMarketing, numEngineer=numEngineer, numSales=numSales, form=form)
def post(self, request): form = SearchForm(request.POST) if form.is_valid() and request.user.is_authenticated: return redirect('search_results', pk=form.cleaned_data['terms'].replace(' ', '+'))
def search(): form = SearchForm() if form.validate_on_submit(): flash('Success search') data = { 'query': form.query.data, 'order': form.order.data, 'reviewer': form.reviewer.data } if form.publication_start.data is not None: if form.publication_end.data is not None: data.update({ 'publication-date': form.publication_start.data + ';' + form.publication_end.data }) else: data.update({'publication-date': form.plulication_start}) if form.opening_start.data is not None: if form.opening_end.data is not None: data.update({ 'opening-date': form.opening_start.data + ';' + form.opening_end.data }) else: data.update({'opening-date': form.opening_start.data}) if form.critics_pick.data: data.update({'critics-pick': 'Y'}) query = {k: v for k, v in data.items() if data[k] is not None} movies = get_movies(query) return render_template('result.html', title='Result', movies=movies) return render_template('search.html', title='Search', form=form)
def search(request): q = "" per_page = 20 page = 1 page_results = None all_items_count = 0 paginator = "" if "q" in request.GET: form = SearchForm(request.GET, request=request) if form.is_valid(): if 'page' in request.GET: page = request.GET["page"] else: page = 1 pages = paginate(page, per_page) q = form.cleaned_data["q"] results = SearchQuerySet().models(SellerItem).auto_query(q) page_results = results[pages["from"]: pages["to"]] url = "/search?q=" + q + "&page=" all_items_count = len(results) paginator = pagination_string(all_items_count, int(page), per_page, url) return render_to_response( 'search/search_home.html', context_instance=RequestContext(request, {"results": page_results, "q": q, "paginator": paginator, "total_results": all_items_count}))
def index(): form = SearchForm() g.search_form = SearchForm() if form.validate_on_submit(): ... return redirect('/result') return render_template('search.html', title='Search', form=form)
def mysql_sqli(): form = SearchForm() if form.validate_on_submit(): search_value = form.search.data query = ("SELECT * FROM MOCK_DATA WHERE `first_name` LIKE '%" + form.search.data + "%' LIMIT 10;") data, error = execute_query(query) query = query.split("--")[0] return render_template( "table.j2.html", title="MySQL Union", form=form, data=data, search_value=search_value, query=query, current_page="mysql_sqli", error=error, record_count=len(data), ) query = "SELECT * FROM MOCK_DATA LIMIT 10;" data, error = execute_query(query) query = query.split("--")[0] return render_template( "table.j2.html", title="MySQL Union", form=form, data=data, search_value="", query=query, current_page="mysql_sqli", error=error, record_count=len(data), )
def buy(): form = SearchForm() if form.validate_on_submit(): items = Item.query.whoosh_search(form.query.data).all() else: items = Item.query.order_by(Item.post_date.desc()).all() return render_template("market/buy.html", buy="active", items=items, form=form)
def list(request): """Renders the member list page.""" assert isinstance(request, HttpRequest) form = SearchForm(request.GET or None) if form.is_valid(): search_name = form.data['search_name'] member_list = Member.objects.filter( Q(name__icontains=search_name) | Q(full_name__icontains=search_name) ).order_by('number') else: member_list = Member.objects.filter( number__gte=1 ).order_by('number') page_no = request.GET.get('page') page = _get_page(member_list, page_no, MEMBER_LIST_PAGE_IN_COUNT ) article_list = Article.objects.order_by('-released_at')[:5] auth_form = AuthenticationForm(None, request.POST or None) return render( request, 'app/member_list.html', { 'title':'会員名簿', 'year':datetime.now().year, 'articles':article_list, 'blogs':EntryView.get_entry_list('-posted_at',-1, request.user.pk )[:5], 'contents':range(1,6), 'member_list':page.object_list, 'form':form, 'auth_form':auth_form, 'current_user':request.user, 'page' : page, 'current_page':request.path #'member_list' } )
def search(): form = SearchForm() if form.validate_on_submit(): if form.search.data: user = form.search.data return redirect(url_for('user_posts', username=user)) return render_template('search.html', form=form)
def search(): """ Handles searching for tv shows or movies. """ # Generate the form form = SearchForm() # If the user has submitted a POST request, it will be validated below. if form.validate_on_submit(): # Retrieve show/movie title and whether it actually is a tv show or movie form_title = form.title.data form_type = form.type.data # Perform necessary searches if form_type == 'tv': results = search_tv(form_title) else: results = search_movie(form_title) # Display results form = QuickAddForm() return render_template('results.html', results=results, type=form_type, form=form) # If the request was GET, render the register page with the search form. return render_template('search.html', form=form)
def product(page, filter=None, data=None): if filter == None: listOfProduct = Product.query.all() elif filter == 'old': oldProductPhotos = Productphoto.query.filter_by(photo_status=3).all() listOfProduct = [] for photo in oldProductPhotos: listOfProduct.append(photo.photo) elif filter == 'search': listOfProduct = Product.query.filter( Product.name.like('%{}%'.format(data))).all() listOfProducts = listOfProduct * 20 productsStore = [[[ 0 if i + j * 9 + k * 3 >= len(listOfProducts) else listOfProducts[i + j * 9 + k * 3] for i in range(3) ] for k in range(3)] for j in range(math.ceil(len(listOfProducts) / 9))] numberOfPages = len(productsStore) products = productsStore[int(page) - 1] categories = Category.query.all() form = SearchForm() if form.validate_on_submit(): searchData = form.search.data return redirect( url_for('product', page=1, filter='search', data=searchData)) return render_template('product.html', categories=categories, products=products, zip=zip, numberOfPages=numberOfPages, page=int(page), filter=filter, data=data, form=form)
def search(): form = SearchForm() if not form.validate(): return redirect(url_for('index')) results, total = Oggetto.search(form.q.data) render_template('search.html', results=results)
def home(title='Home'): """Home page""" form = SearchForm() # Get links using Wikipedia's search API if form.validate_on_submit(): search_term = '_'.join(form.data['search_term'].split()) flash(search_term) search_api = 'http://en.wikipedia.org/w/api.php?action=opensearch&search=' + search_term headers = { 'Host': 'en.wikipedia.org', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0', 'Accept': '*/*', 'Accept-Language': 'en-US,en;q=0.5', 'Accept-Encoding': 'gzip, deflate', 'DNT': 1, 'Referer': 'http://www.wikipedia.org/', 'Connection': 'keep-alive' } response = json.loads(requests.get(search_api, headers=headers).text) session['links'] = response[ 3] # store links in a session object to be obtained during next request print response print response[3] return redirect('/search_results') return render_template('home.html', title=title, form=form)
def search(): form = SearchForm() if form.validate_on_submit(): c = int(form.category.data) s = form.search.data if c == 0: # автор writer = Writer.query.filter_by(name=s).first() if writer: return redirect(url_for('writer', writer_id=writer.id)) else: return render_template('search.html', title="Поиск", form=form, err=True) elif c == 1: # книга book = Book.query.filter_by(title=s).first() if book: return redirect(url_for('book', book_id=book.id)) else: return render_template('search.html', title="Поиск", form=form, err=True) elif c == 2: # комментарий user = User.query.filter_by(login=s).first() if user: return redirect(url_for('user', user_id=user.id)) else: return render_template('search.html', title="Поиск", form=form, err=True) return render_template('search.html', title="Поиск", form=form, err=False)
def search(): form = SearchForm() template = 'search.html' if form.validate_on_submit(): if (form.zipcode.data is "" and form.city.data is "" and form.state.data is ""): flash('Please fill in a field to search') return render_template(template, title='search', config=site_config, form=form) locations = search_locations(form) return render_template(template, title='search', config=site_config, form=form, locations=locations) return render_template(template, title='search', config=site_config, form=form)
def index_update(): form = SearchForm() error = None from_day = None to_day = None teacher = None lessons = {} if form.validate_on_submit(): group = form.groupname.data from_day = form.from_day.data to_day = form.to_day.data teacher = form.teacher.data try: group_record = Group.query.filter_by(name=group).first() lessons = utils.get_lessons_range(group_record, from_day, to_day) app.logger.info(lessons) except SQLAlchemyError as e: error = "Incorrect input data!" return render_template('index.html', form=form, day_schedule=lessons, error=error)
def test_city_search(self): data = {'city': 'Portland'} factory = RequestFactory() request = factory.post('/', data) form = SearchForm(request.POST) self.assertTrue(form.is_valid()) self.assertEqual(form.cleaned_data['city'], data['city'])
def signup(): search = SearchForm() if request.method == 'POST' and search.validate_on_submit(): return redirect((url_for('search_page', searchQuery=search.searchParam.data))) if session.get('logged_in') == True: return redirect(url_for('index')) form = SignupForm() if form.validate_on_submit(): name = form.restaurant_name.data email = form.restaurant_email.data phone = form.restaurant_phone.data zipcode = form.restaurant_zipcode.data address = form.restaurant_street.data + form.restaurant_city.data + form.restaurant_state.data new_seller = seller(seller_name=name, seller_email=email, seller_phone=phone, seller_zipcode=zipcode, seller_address=address) new_seller.set_password(form.restaurant_password.data) db.session.add(new_seller) db.session.commit() session["user_id"] = new_seller.seller_id session["logged_in"] = True return redirect(url_for('index')) return render_template('signup.html', title='Sign Up', form=form, search=search)
def search(): form = SearchForm() if form.validate_on_submit(): coin = form.user_input.data coin = str(coin).replace(" ", "-").lower() return redirect(url_for('.search_coin', coin=coin)) return render_template('search.html', title='Search Coins', form=form)
def search(): form = SearchForm() if form.validate_on_submit(): src = string(request.args[src]) return '''<h1>The Source is {}</h1>'''.format(src) return render_template('search.html', title='Search Pcap', form=form)
def index(): form = SearchForm() if form.validate_on_submit(): render_template('index.html', form=form) else: flash_errors(form) return render_template('index.html', form=form)
def mysql_time(): query = "" search_value = "" current_page = "mysql_time" title = "MySQL Time-Based" form = SearchForm() if form.validate_on_submit(): search_value = form.search.data query = f"SELECT * FROM MOCK_DATA WHERE `email` = '{form.search.data}';" execute_query(query) return render_template( "time.j2.html", title=title, form=form, search_value=search_value, current_page=current_page, query=query, success=True, ) return render_template( "time.j2.html", title=title, form=form, search_value=search_value, current_page=current_page, query=query, )
def index(): form = SearchForm() if form.validate_on_submit(): interface = SearchInterface() interface.search_job(form.query.data) return render_template('results.html', form=form, interface=interface) return render_template('index.html', title='Sign In', form=form)
def index(): requests = Request.query.all() search = SearchForm(request.form) search.origin.choices = sorted(app.config['LOCATIONS'], key=lambda x: x[1]) search.destination.choices = sorted(app.config['LOCATIONS'], key=lambda x: x[1]) if search.validate_on_submit(): if search.destination.data == search.origin.data: flash("Origin and Destination cannot be the same") else: return redirect( url_for('search_results', origin=search.origin.data, destination=search.destination.data, date=search.date.data)) if current_user.is_authenticated: return render_template('index.html', user=current_user, requests=requests, form=search) else: return render_template('index.html')
def search(dishname): form = SearchForm() if form.validate_on_submit(): return redirect(url_for('search', dishname=form.search.data)) dishes = Dishes.query.all() for dish in dishes: if dish.dishname.upper() == dishname.upper(): if not current_user.is_anonymous: quantity = Quantity.query.filter_by(customer=current_user) \ .filter_by(dish=dish).first() return render_template('search.html', title='Search', dish=dish, quantity=quantity, next_page='search', form=form) else: return render_template('search.html', title='Search', dish=dish, next_page='search', form=form) flash("Sorry, this dish is not available here.") return redirect(url_for('index'))
def search(): form = SearchForm() if form.validate_on_submit(): search_term = form.search_term.data return redirect(url_for('gallery', search_term=search_term)) return redirect(url_for('home'))
def index(): form = SearchForm() message = None lessons = {} if form.validate_on_submit(): group = form.groupname.data from_day = form.from_day.data to_day = form.to_day.data teacher = form.teacher.data group = Group.query.filter_by(name=group).first() if not group: flash(f'Group not found', 'info') return redirect(url_for('index')) pib_len = 3 if not teacher: lessons = utils.get_lessons_range(group, from_day, to_day) elif len(teacher.split()) == pib_len: name, surname, patronymic = teacher.split() teacher = utils.get_teacher(name, surname, patronymic) lessons = utils.get_lessons_range_with_teacher( group, teacher, from_day, to_day) else: flash('Teacher not found', 'info') return redirect(url_for('index')) if not lessons: flash(f'No lessons for this period', 'info') return redirect(url_for('index')) return render_template('index.html', form=form, day_schedule=lessons)
def search(): form = SearchForm() if form.validate_on_submit(): stats = teamsfranchises.query.filter_by( franchName=form.team.data).all() teamStats = teams.query.filter_by(yearID=form.yearID.data).join( teamsfranchises, teamsfranchises.franchID == teams.franchID).filter_by( franchName=form.team.data).all() batStats = batting.query.filter_by(yearID=form.yearID.data).join( teams, teams.teamID == batting.teamID).join( teamsfranchises, teamsfranchises.franchID == teams.franchID).filter_by( franchName=form.team.data).all() for row in batStats: if row.pa is None: row.setValues() pitchStats = pitching.query.filter_by(yearID=form.yearID.data).join( teams, teams.teamID == pitching.teamID).join( teamsfranchises, teamsfranchises.franchID == teams.franchID).filter_by( franchName=form.team.data).all() for row in pitchStats: if row.ip is None: row.setIP() fieldingStats = fielding.query.filter_by(yearID=form.yearID.data).join( teams, teams.teamID == fielding.teamID).join( teamsfranchises, teamsfranchises.franchID == teams.franchID).filter_by( franchName=form.team.data).all() # I'm afraid this query is incorrect in its calculation for all players on the team. I was trying to figure out the union operator from SQL Alchemy but i couldn't figure it out in time. I would assume that you would use the union operator and separate queries for the three positions (fielding, batting, and pitching) to find all of the players on the team. players = people.query.join( pitching, pitching.playerID == people.playerID).join( batting, batting.playerID == people.playerID).filter_by( yearID=form.yearID.data).join( teamsfranchises, teamsfranchises.franchID == batting.teamID).filter_by( franchName=form.team.data).all() teamManagers = managers.query.filter_by(yearID=form.yearID.data).join( teamsfranchises, teamsfranchises.franchID == managers.teamID).filter_by( franchName=form.team.data).all() return render_template('search.html', title='Results', form=form, stats=stats, batStats=batStats, pitchStats=pitchStats, teamManagers=teamManagers, players=players, teamStats=teamStats) return render_template('search.html', title='Search', form=form)
def post_search(request): if request.method == 'GET': form = SearchForm(request.GET) if form.is_valid(): text = form.data['q'] posts = Post.objects.order_by('-created_at').filter(Q(title__contains=text) | Q(content__contains=text) , Q(is_page=False)) if posts: return render(request, 'search.html', {'posts': posts, 'text' :text }) else: return render(request, 'search.html', {'error': 'Aranan kelime bulunamadı.', 'text':text}) else: return render(request, 'search.html', {'error': 'Boş arama yaptın!.', 'text':'Hata'})
def search(): search_form = SearchForm(request.form) if not search_form.validate(): return render_template('search_result.html', books = [], search_form = search_form) search_phrase = "%%%s%%" % search_form.text.data books_by_title = Book.query.filter(Book.title.ilike(search_phrase)).all() if search_form.by_title.data else [] authors_by_name = Author.query.filter(Author.name.ilike(search_phrase)).all() if search_form.by_author.data else [] books = set(books_by_title + [authorship.book for author in authors_by_name for authorship in author.authorships]) #form = SearchForm().set_defaults() form = SearchForm() return render_template('search_result.html', books = books, search_form = form)
def search(request, query=""): searchForm = SearchForm(request.GET or None) if request.method == "GET": if searchForm.is_valid(): cd = searchForm.cleaned_data #redirect to this function, but send the search into the query. #print "redirecting" return HttpResponseRedirect("/search/"+cd['query']+"/") idea_results = [] if query != "": ideas_with_tags = Tag.objects.filter(tag__contains=query) all_ideas = Idea.objects.filter(idea__contains=query) for idea in ideas_with_tags: idea_results.append(idea.idea) for idea in all_ideas: if idea not in idea_results: idea_results.append(idea) return render_to_response("main/idea_list.html", locals(), context_instance=RequestContext(request))
def index(): form = SearchForm() books = models.Book.query.all() choices = [('', '---------------')] choices.extend([(a.id, a.name) for a in models.Author.query.all()]) if form.is_submitted(): title = form.title.data ath_id = [a for a in form.authors.data.split(',') if a] ath = models.Author.query.filter(models.Author.id.in_(ath_id)).all() books = models.Book.query.filter(models.Book.name.like('%'+title+'%')).all() if len(ath): for a in ath: tmp1 = [b for b in books if a in b.authors] books = [k for k in tmp1 if k in books] return render_template('Books.html', title='Books ', form=form, choices=choices, books=books)
def index(request): form = SearchForm() if request.method == 'POST': form = SearchForm(request.POST) if form.is_valid(): query = form.cleaned_data['query'] try: result, suggest = go_search(query) return render(request, 'app/result.html', { 'form': form, 'result': result, 'suggest': suggest }) except ValueError, error: messages.error(request, error.message) return HttpResponseRedirect('') else: print "Invalid" messages.error(request, form.errors)
def dispatch_request(self, t="search.html"): book_mgr = BookAbstraction() author_mgr = AuthorAbstraction() result = [] form = SearchForm() if request.method == 'POST': if form.validate_on_submit(): if len(form.search.data) < 2: return redirect(url_for('search')) result = book_mgr.book_search(form.search.data) result.extend(author_mgr.author_search(form.search.data)) if not result: result = "No books found" else: result = set(result) return render_template(t, form=form, result=result, page_title='Search', user=current_user)
def search(): ''' Generic search page ''' form = SearchForm(request.args, csrf_enabled=False) if not form.validate(): return render_template('search.html', form=form) else: result_tabs = [] active_result_tab = None query = User.query_in_deployment() #pylint: disable=no-member if (form.questionnaire_area.data and form.questionnaire_area.data != 'ZZ'): questionnaire_id = form.questionnaire_area.data num_skills_column = func.count(UserSkill.id).label('num_skills') query = query.add_column(num_skills_column).\ filter(UserSkill.user_id == User.id).\ filter(UserSkill.name.like(questionnaire_id + "_%")).\ filter(UserSkill.level == form.skill_level.data).\ group_by(User).\ order_by(num_skills_column.desc()) base_args = request.args.copy() if 'skill_level' in base_args: del base_args['skill_level'] tab_names = ( ('LEVEL_I_CAN_DO_IT', gettext('Practitioners')), ('LEVEL_I_CAN_EXPLAIN', gettext('Explainers')), ('LEVEL_I_CAN_REFER', gettext('Connectors')), ('LEVEL_I_WANT_TO_LEARN', gettext('Peers')), ) for level_id, tab_label in tab_names: tab_args = base_args.copy() tab_args['skill_level'] = str(LEVELS[level_id]['score']) tab_url = '%s?%s#results' % ( url_for('views.search'), urlencode(tab_args) ) if form.skill_level.data == LEVELS[level_id]['score']: active_result_tab = level_id result_tabs.append((level_id, tab_label, tab_url)) else: # Add fake rank of 0 for now query = query.add_column('0') if form.country.data and form.country.data != 'ZZ': query = query.filter(User.country == form.country.data) if form.locale.data and form.locale.data != 'ZZ': query = query.join(User.languages).filter(UserLanguage.locale.in_( [form.locale.data])) if (form.expertise_domain_name.data and form.expertise_domain_name.data != 'ZZ'): query = query.join(User.expertise_domains).filter( UserExpertiseDomain.name.in_( [form.expertise_domain_name.data] ) ) if form.fulltext.data: ftquery = "%" + form.fulltext.data + "%" query = query.filter(or_( User.first_name.ilike(ftquery), User.last_name.ilike(ftquery), User.organization.ilike(ftquery), User.position.ilike(ftquery), User.projects.ilike(ftquery), (User.first_name + ' ' + User.last_name).ilike(ftquery) )) return render_template('search.html', result_tabs=result_tabs, active_result_tab=active_result_tab, form=form, results=query.limit(20).all())