implemented viewcount
This commit is contained in:
parent
a8b2b6d1c0
commit
dab1a625c6
6 changed files with 24 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue