def search(search): if request.method == 'POST': searchTerm = request.form['search_term'].replace(' ', '-') return redirect(url_for('search', search=searchTerm)) return render_template("result.html", title_list=scrape(search), pageTitle="%s News Results" % (search))
def login(): if request.method == "GET": if "logged_in" in session and session["logged_in"]: return render_template(url_for("home")) else: return render_template("login.html") else: return "not get"
def add_results(): form = StudentForm() if form.validate_on_submit(): student = Student( name=form.name.data, physics=form.physics.data, maths=form.maths.data, chemistry=form.chemistry.data, ) db.session.add(student) db.session.commit() return redirect(url_for('add_results')) else: return render_template('home.html', form=form)
def edit_store(store_id): store = Store.get_by_id(store_id) if request.method == 'POST': name = request.form['name'] url_prefix = request.form['url_prefix'] tag_name = request.form['tag_name'] query = json.loads(request.form['query']) store.name = name store.url_prefix = url_prefix store.tag_name = tag_name store.query = query store.save_to_mongo() return redirect(url_for('.index')) return render_template('stores/edit_store.html', store=store)
def home(): if "logged_in" in session and session["logged_in"]: return render_template("home.html") else: return redirect(url_for("login"))
def login(): if request.method == "POST": user = request.form["nm"] return redirect(url_for("user", usr=user)) else: return render_template("login.html")
def index(): if request.method == 'POST': searchTerm = request.form['search_term'].replace(' ', '-') return redirect(url_for('search', search=searchTerm)) return render_template("index.html", pageTitle="Google News Webscraper")
def delete_store(store_id): Store.get_by_id(store_id).remove_from_mongo() return redirect(url_for('.index'))