Views
This folder contains the functions that are used to render the front-end of the website and the routes of the website.
What is it ?
The views rely on the templates and the controllers to render the front-end of the website. They receive the data from the back-end and render the front-end via Jinja templates
.
How does it work ?
Routes are triggered whenever the user access a certain URL as follows:
#Example
@login_required
@main.route("/categories", methods=["GET", "POST"])
def categories(): # Categories list
args = CategoryController.list(request.args)
#Code to create the variables used to render the template
#Render via Jinja
return render_template(
"categories.html",
categories=args,
#Other variables
)