Updated the models and views of the Forum Application. Updated the neccesary...

Updated the models and views of the Forum Application. Updated the neccesary files in the Dashboard and Announcement Applications. Filled in information in the database.
parent 6ee33d60
# Generated by Django 3.2 on 2023-03-06 09:38
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('forum', '0004_forumpost_author_reply_author'),
]
operations = [
migrations.RenameField(
model_name='reply',
old_name='replied_post',
new_name='forum_post',
),
]
......@@ -16,7 +16,7 @@ class Reply(models.Model):
body = models.TextField(default = "", null = True,)
author = models.ForeignKey(WidgetUser, on_delete = models.CASCADE, default = "", null = True,)
pub_datetime = models.DateTimeField(null = True,)
replied_post = models.ForeignKey(ForumPost, on_delete = models.CASCADE, null = True,)
forum_post = models.ForeignKey(ForumPost, on_delete = models.CASCADE, null = True,)
......
......@@ -8,13 +8,11 @@ def forum(request):
replies = Reply.objects.all()
response = "Widget's Forums <br> <br>" + "Forum Posts: <br>"
for post in posts:
post_name = "test"
#post.author.first_name + " " + post.author.last_name
response += post.title + " by " + post_name + " posted " + post.pub_datetime.strftime("%a, %b %d, %Y %I:%M %p") + ": <br>" + post.body + "<br>"
post_name = post.author.first_name + " " + post.author.last_name
response += "<br>" + post.title + " by " + post_name + " posted " + post.pub_datetime.strftime("%a, %b %d, %Y %I:%M %p") + ": <br>" + post.body + "<br>"
for reply in replies:
if(post.title == reply.replied_post.title):
reply_name = "reply test"
#reply.author.first_name + " " + reply.author.last_name
if(post.title == reply.forum_post.title):
reply_name = reply.author.first_name + " " + reply.author.last_name
response += "Reply by " + reply_name + " posted " + reply.pub_datetime.strftime("%a, %b %d, %Y %I:%M %p") + ": <br>" + reply.body + "<br>"
return HttpResponse(response)
......
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