rename blueprint variables (blueprint_name -> bp) and view files (views.py -> routes.py)

This commit is contained in:
Patrick Jentsch
2021-09-13 11:45:43 +02:00
parent bc5c8ef074
commit 4950a407af
18 changed files with 85 additions and 85 deletions

View File

@ -1,5 +1,5 @@
from flask import Blueprint
main = Blueprint('main', __name__)
from . import views
bp = Blueprint('main', __name__)
from . import routes

View File

@ -1,11 +1,11 @@
from flask import flash, redirect, render_template, url_for
from flask_login import login_required, login_user
from . import main
from . import bp
from ..auth.forms import LoginForm
from ..models import User
@main.route('/', methods=['GET', 'POST'])
@bp.route('/', methods=['GET', 'POST'])
def index():
form = LoginForm(prefix='login-form')
if form.validate_on_submit():
@ -19,28 +19,28 @@ def index():
return render_template('main/index.html.j2', form=form, title='nopaque')
@main.route('/about_and_faq')
@bp.route('/about_and_faq')
def about_and_faq():
return render_template('main/about_and_faq.html.j2', title='About and faq')
@main.route('/dashboard')
@bp.route('/dashboard')
@login_required
def dashboard():
return render_template('main/dashboard.html.j2', title='Dashboard')
@main.route('/news')
@bp.route('/news')
def news():
return render_template('main/news.html.j2', title='News')
@main.route('/privacy_policy')
@bp.route('/privacy_policy')
def privacy_policy():
return render_template('main/privacy_policy.html.j2',
title='Privacy statement (GDPR)')
@main.route('/terms_of_use')
@bp.route('/terms_of_use')
def terms_of_use():
return render_template('main/terms_of_use.html.j2', title='Terms of Use')