Commit 6b7d6249 authored by Stephanie Tullao's avatar Stephanie Tullao

Altered variable name from pk to post_id

parent 7d3d895a
...@@ -4,7 +4,7 @@ from .views import post_list_view, post_detail_view ...@@ -4,7 +4,7 @@ from .views import post_list_view, post_detail_view
urlpatterns = [ urlpatterns = [
path('', post_list_view, name='post-list'), path('', post_list_view, name='post-list'),
path('<int:pk>/details', post_detail_view, name='post-details'), path('<int:post_id>/details', post_detail_view, name='post-details'),
] ]
app_name = 'forum' app_name = 'forum'
\ No newline at end of file
...@@ -11,8 +11,8 @@ def post_list_view(request): ...@@ -11,8 +11,8 @@ def post_list_view(request):
return render(request, 'forum/forum_list.html', context) return render(request, 'forum/forum_list.html', context)
def post_detail_view(request, pk): def post_detail_view(request, post_id):
post = Post.objects.get(pk=pk) post = Post.objects.get(id=post_id)
reply_list = Reply.objects.filter(original_post=post).order_by('-pub_date').all() reply_list = Reply.objects.filter(original_post=post).order_by('-pub_date').all()
context = {'post': post, context = {'post': post,
'reply_list': reply_list 'reply_list': reply_list
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<h1>Forum posts:</h1> <h1>Forum posts:</h1>
{% for post in post_list %} {% for post in post_list %}
<li> <li>
<a href="{% url 'forum:post-details' pk=post.pk %}"> <a href="{% url 'forum:post-details' post_id=post.pk %}">
{{ post.post_title }} by {{ post.author.first_name }} {{ post.author.last_name }} dated {{ post.pub_date|date:"d/m/Y" }} {{ post.post_title }} by {{ post.author.first_name }} {{ post.author.last_name }} dated {{ post.pub_date|date:"d/m/Y" }}
</a> </a>
</li> </li>
......
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