Commit fcc9f836 authored by Trisha Angel Millena's avatar Trisha Angel Millena Committed by Ysabella Panghulan

Edited models.py and views.py

parent af12b8db
File added
......@@ -8,7 +8,7 @@ class ForumPost(models.Model):
title = models.CharField(max_length = 300)
body = models.TextField(max_length = 500)
author = models.ForeignKey(WidgetUser, on_delete = models.CASCADE)
pub_datetime = models.DateTimeField()
pub_datetime = models.DateTimeField(auto_now_add = True)
def __str__(self):
return self.title
......
......@@ -5,7 +5,7 @@ from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView, UpdateView
def forum(request):
posts = ForumPost.objects.all()
posts = ForumPost.objects.all().order_by('-pub_datetime')
replies = Reply.objects.all()
context = {
'forumposts':posts,
......
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