def search(): g.search_form = SearchForm() if not g.search_form.validate(): return redirect(request.referrer) #return redirect(url_for('main.home')) posts, total = Post.search(g.search_form.q.data) return render_template('search.html', title='Search', posts=posts)
def before_request(): """Record the time of any request done by an authenticated user and stores it to the 'last_seen' field in the User model""" if current_user.is_authenticated: current_user.last_seen = datetime.utcnow() db.session.commit() g.search_form = SearchForm() g.locale = str(get_locale())
def before_request(): if current_user.is_authenticated: current_user.last_seen = datetime.utcnow() db.session.commit() g.search_form = SearchForm()
def before_request(): if current_user.is_authenticated or current_user.is_anonymous: g.search_form = SearchForm()