-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from flask import Blueprint | ||
from flask import render_template | ||
|
||
from . import db | ||
from . import models | ||
|
||
bp = Blueprint("core", __name__) | ||
|
||
|
||
@bp.route("/", defaults={"path": ""}) | ||
@bp.route("/<path:path>/") | ||
def page(path: str) -> str: | ||
obj = db.get_or_404(models.Page, path) | ||
return render_template([f"{path}.html", "page.html"], page=obj) | ||
|
||
|
||
@bp.route("/people/<path>") | ||
def person(path: str) -> str: | ||
obj = db.get_or_404(models.Person, path) | ||
return render_template("person.html", page=obj) | ||
|
||
|
||
@bp.route("/p/<path>") | ||
def project(path: str) -> str: | ||
obj = db.get_or_404(models.Project, path) | ||
return render_template("project.html", page=obj) | ||
|
||
|
||
@bp.route("/blog/<path:path>") | ||
def blog_post(path: str) -> str: | ||
obj = db.get_or_404(models.BlogPost, path) | ||
return render_template("blog.html", page=obj) |