Beispiel #1
0
def get_five():
    if request.method == 'GET':
        latest_questions = data_manager.get_latest_questions()
        return render_template("landing.html",
                               all_data_reversed=latest_questions)
    elif request.method == "POST":
        search_text = request.form.get('search_text')
        return redirect(url_for('searched_question', search_text=search_text))
Beispiel #2
0
def registration():
    if request.method == 'GET':
        return render_template('registration.html')
    if request.method == 'POST':
        password = request.form.get('password')
        hashed = bcrypt.hashpw(password.encode('utf-8'), bcrypt.gensalt())
        hashed = hashed.decode('utf-8')
        users = {
            'email': request.form.get('email'),
            'user_name': request.form.get('user_name'),
            'password': hashed
        }
        data_manager.insert_registration(users)
    latest_questions = data_manager.get_latest_questions()
    return render_template("landing.html", all_data_reversed=latest_questions)
Beispiel #3
0
def index():
    questions = data_manager.get_latest_questions()
    return render_template('list.html', questions=questions, latest=True)
Beispiel #4
0
def latest_questions():
    data = data_manager.get_latest_questions()
    return render_template('list.html', data=data)
Beispiel #5
0
def get_latest():
    return data_manager.get_latest_questions()
Beispiel #6
0
def index():
    if g.user:
        data = data_manager.get_latest_questions()
        return render_template("list.html", all_questions=data)
    return redirect(url_for('login'))
Beispiel #7
0
def index():
    latest_questions = data_manager.get_latest_questions(5)
    return render_template('index.html', questions=latest_questions)
Beispiel #8
0
def main_page():
    questions = data_manager.get_latest_questions()
    return render_template('list.html', questions=questions, link=True)
def index():
    is_list_truncated = True
    number_of_questions_to_show = 5
    list_of_questions = data_manager.get_latest_questions(number_of_questions_to_show)
    return render_template('list.html', questions=list_of_questions, truncated=is_list_truncated)
Beispiel #10
0
def index_route():
    list_latest_questions = data_manager.get_latest_questions()
    fieldnames = ["Submission time", "View number", "Vote number", "Title"]
    return render_template("index.html", latest_questions=list_latest_questions, headers=fieldnames)