You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
893 B

from flask import render_template, request, Blueprint
from minibase.models import Post
from minibase.config import themeMinibase
# Declaring a blueprint
main = Blueprint('main', __name__)
# Redirect from / and also /home routes to the /
@main.route("/")
@main.route("/home")
def home():
# (PAGINATION) Defines the page number that we will start with
page = request.args.get('page', 1, type=int)
# (POSTS) Query posts usin SQLAlchemy
posts = Post.query.order_by(Post.date_posted.asc()).paginate(per_page=2)
# (HTML) Renders the template for templates/home.html
return render_template('home.html', theme=themeMinibase, posts=posts)
@main.route("/about")
def about():
return render_template('about.html', theme=themeMinibase, title='About')
@main.route("/customer")
def customer():
return render_template('customer.html', theme=themeMinibase, title='About')