Commit 23dc7990 authored by Mary Adelaide A. Salto's avatar Mary Adelaide A. Salto
parents 336d59e7 7e600232
from django.db import models from django.db import models
from django.utils import timezone
from dashboard.models import WidgetUser from dashboard.models import WidgetUser
...@@ -17,4 +17,7 @@ class Reply(models.Model): ...@@ -17,4 +17,7 @@ class Reply(models.Model):
post = models.ForeignKey(ForumPost, on_delete=models.CASCADE, null=True) post = models.ForeignKey(ForumPost, on_delete=models.CASCADE, null=True)
body = models.TextField() body = models.TextField()
author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE) author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE)
pub_datetime = models.DateTimeField() pub_datetime = models.DateTimeField(default=timezone.now, null=True, blank=True)
def __str__(self):
return self.post
\ No newline at end of file
...@@ -4,7 +4,7 @@ from django.http import HttpResponse ...@@ -4,7 +4,7 @@ from django.http import HttpResponse
from .models import ForumPost, Reply from .models import ForumPost, Reply
# Create your views here. # Create your views here.
def index(request): def index(request):
page_content = "<p>Widget's Forum</> Forum Posts:<br>" page_content = "<p>Widget's Forum Posts:<br>"
for post in ForumPost.objects.all(): for post in ForumPost.objects.all():
page_content += '{} by {} {} posted {}:<br>{}<br>'.format( page_content += '{} by {} {} posted {}:<br>{}<br>'.format(
......
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