aboutsummaryrefslogtreecommitdiff
path: root/app/views/main.py
blob: 308c6ac89422604071aa1603c924a28023568a5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# -*- coding: utf-8 -*-
"""
This is the main views module.

You should import all other views into this file rather than individually importing in __init__.py
"""

from app import app
from app.forms.app_forms import MyForm
from flask import render_template, flash
from app.views import auth, error_pages, admin
from app.misc_func import flash_errors


@app.route("/")
@app.route("/index")
def index():
    """
    The view for the landing page.
    """
    return render_template("index.html")


@app.route("/ContactUs", methods=["GET", "POST"])
def contact_us():
    """
    A simple contact us form with basic validation.

    This dummy form has not been linked to any database.
    """
    form = MyForm()
    if form.validate_on_submit():
        return "Wuhu"
    flash_errors(form)
    return render_template("contact.html", form=form)