feat: displayed in order of publication date

parent 3cecec8c
...@@ -3,5 +3,5 @@ from . import views ...@@ -3,5 +3,5 @@ from . import views
urlpatterns = [ urlpatterns = [
path('', views.index, name="index"), path('', views.index, name="index"),
path('welcome', views.welcome, name='welcome') # path('welcome', views.welcome, name='welcome')
] ]
\ No newline at end of file
...@@ -3,10 +3,13 @@ from django.http import HttpResponse ...@@ -3,10 +3,13 @@ from django.http import HttpResponse
from .models import Post, Reply from .models import Post, Reply
# Create your views here. # Create your views here.
def welcome(request):
return HttpResponse("Welcome to Widget's forum!")
def index(request): def index(request):
posts_list = Post.objects.order_by("pub_date")
output = ", ".join([p.post_title for p in posts_list])
return HttpResponse(output)
# return HttpResponse("Welcome to Widget's forum!")
def welcome(request):
forum_view = "FORUM POSTS: " forum_view = "FORUM POSTS: "
# posts = Post.objects.all() # posts = Post.objects.all()
# replies = Reply.objects.all() # replies = Reply.objects.all()
......
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