Commit 068cf53b authored by N1o9r4b7e9r6to's avatar N1o9r4b7e9r6to

removed comments & codes, change order method to be more apt

parent 3ce4bf3c
from django.shortcuts import render from django.shortcuts import render
from . import models from . import models
#from asyncio.windows_events import NULL from django.http import Http404, HttpResponse
from django.http import HttpResponse from django.http import HttpResponse
from django.template import Template, Context from django.template import Template, Context
from django.template.loader import get_template from django.template.loader import get_template
from forum.models import Post, Reply from forum.models import Post, Reply
def forumposts(request): def forumposts(request):
all_posts = models.Post.objects.order_by("-pub_date") all_posts = models.Post.objects.order_by("-id")
#all_replies = models.Reply.objects.all()
context = { context = {
"all_posts":all_posts, "all_posts":all_posts,
#"all_replies":all_replies
} }
return render(request, "forum/forum.html", context) return render(request, "forum/forum.html", context)
def forumreplies(request):
all_replies = models.Reply.objects.all()
context = {
#"all_posts":all_posts,
"all_replies":all_replies
}
return render(request, "forum/details.html", context)
def DisplayPostdetails(request, post_id): def DisplayPostdetails(request, post_id):
try:
post = Post.objects.get(pk=post_id) post = Post.objects.get(pk=post_id)
reply = Reply.objects.order_by("-pub_date") reply = Reply.objects.order_by("-id")
except Post.DoesNotExist:
raise Http404("This Post Does Not Exist!")
context = { context = {
"post":post, "post":post,
"reply":reply, "reply":reply,
......
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