Commit 5317f0bf authored by Eury See's avatar Eury See

Modified a variable name in models.py and views.py of Forum application.

parent 23908c11
# Generated by Django 4.1.7 on 2023-03-06 05:12
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('Forum', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='reply',
old_name='reply_to',
new_name='forum_post',
),
]
......@@ -13,7 +13,7 @@ class Reply(models.Model):
body = models.TextField()
author = models.CharField(max_length = 50)
pub_datetime = models.DateTimeField()
reply_to = models.ForeignKey(ForumPost, on_delete=models.CASCADE)
forum_post = models.ForeignKey(ForumPost, on_delete=models.CASCADE)
def __str__(self):
return self.body
......
......@@ -8,7 +8,7 @@ def index(request):
return_string = "<br>"
for reply in Reply.objects.all():
return_string += '{} by {} posted {}, {}: <br> {} <br> Reply by {} posted {}, {}: <br> {}'.format(
reply.reply_to.title, reply.reply_to.author, reply.reply_to.pub_datetime.strftime("%m/%d/%Y"), reply.reply_to.pub_datetime.strftime("%I:%M %p"), reply.reply_to.body,
reply.forum_post.title, reply.forum_post.author, reply.forum_post.pub_datetime.strftime("%m/%d/%Y"), reply.forum_post.pub_datetime.strftime("%I:%M %p"), reply.forum_post.body,
reply.author, reply.pub_datetime.strftime("%m/%d/%Y"), reply.pub_datetime.strftime("%I:%M %p"), reply.body
)
return_string += "<br><br>"
......
No preview for this file type
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