implemented viewcount

This commit is contained in:
CDaut 2022-09-12 00:37:42 +02:00 committed by CDaut
parent a8b2b6d1c0
commit dab1a625c6
6 changed files with 24 additions and 2 deletions

View file

@ -32,6 +32,8 @@ def render_md_file(path) -> Template:
def viewblog(request, title) -> HttpResponse:
post = Blogpost.objects.get(title=title)
post.views += 1
post.save()
filepath = os.path.join(os.environ.get("MD_FILE_PATH"), title + ".md")
rendered_html = render_md_file(filepath)