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

34 lines
751 B
Python

from flask import Blueprint, render_template, send_from_directory
import json
from . import dump
import os
bp = Blueprint(
"generate",
__name__,
url_prefix="/generate",
)
@bp.route("/")
2 years ago
def blocks():
# temporary, eventually we will dump contents only when they are updated (git hooks + git pull ?)
dump.dump()
with open("postit/contents.json", "r") as f:
contents = json.load(f)
return render_template("postit.html", contents=contents)
2 years ago
@bp.route("/<slug>")
def block(slug=None):
dump.dump()
with open("postit/contents.json", "r") as f:
contents = json.load(f)
block = [post for post in contents if post["slug"] == slug]
return render_template("postit-single.html", contents=block)