Commit d63291a8 authored by karin-kurusu's avatar karin-kurusu

Created forumpost-details and fixed typos in views.py

parent d158e881
{% extends 'base.html' %}
{% load static %}
{% block title %}{{ forumpost.title}} (% endblock %)
{% block content %}
<h2>{{ forumpost.title }}</h2>
<h3> by {{forumpost.author.first_name}} {{ forumpost.author.last_name }}</h3>
<p>{{forumpost.pub_datetime}}</p>
<br>
<p>{{forumpost.body}}</p>
<br>
<h2>POST REPLIES:</h2>
<br>
{% for reply in replys %}
<h3> by {{reply.author.first_name}} {{ reply.author.last_name }}</h3>
<p>{{reply.pub_datetime}}</p>
<br>
<p>{{reply.body}}</p>
<br>
{% endfor %}
<form action="edit">
<input type="submit" value="Edit Post"/>
</form>
{% endblock %}
\ No newline at end of file
...@@ -12,8 +12,8 @@ def pageview(request): ...@@ -12,8 +12,8 @@ def pageview(request):
class ForumpostDetailView(DetailView): class ForumpostDetailView(DetailView):
def get(self, request, pk): def get(self, request, pk):
forumpost = ForumPost.objects.get(pk=pk) forumpost = ForumPost.objects.get(pk=pk)
reply = Reply.objects.filter(forum_post=forumpost) replys = Reply.objects.filter(forum_post=forumpost)
return render(request, 'forum/forumpost-details.html', {'forumpost': forumpost, 'reply': reply}) return render(request, 'forum/forumpost-details.html', {'forumpost': forumpost, 'replys': replys})
class ForumpostCreateView(CreateView): class ForumpostCreateView(CreateView):
model = ForumPost model = ForumPost
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment