Commit f0dde999 authored by Ron Rodillas's avatar Ron Rodillas

Changed variable name for reply model's foreign key in accordance to updated specs

parent f65f7d1a
No preview for this file type
# Generated by Django 4.1.7 on 2023-03-06 06:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('forum', '0002_reply_reply_to'),
]
operations = [
migrations.RenameField(
model_name='reply',
old_name='reply_to',
new_name='forum_post',
),
]
...@@ -17,7 +17,7 @@ class Reply (models.Model): ...@@ -17,7 +17,7 @@ class Reply (models.Model):
body = models.TextField() body = models.TextField()
author = models.CharField(max_length=100) author = models.CharField(max_length=100)
pub_datetime = models.DateTimeField(auto_now_add=True) pub_datetime = models.DateTimeField(auto_now_add=True)
reply_to = models.ForeignKey(ForumPost, on_delete=models.CASCADE) forum_post = models.ForeignKey(ForumPost, on_delete=models.CASCADE)
def datetime_posted(self): def datetime_posted(self):
return self.pub_datetime.strftime('%m/%d/%Y, %I:%M %p') return self.pub_datetime.strftime('%m/%d/%Y, %I:%M %p')
\ No newline at end of file
...@@ -11,7 +11,7 @@ def index(request): ...@@ -11,7 +11,7 @@ def index(request):
+ i.body + "<br>" + i.body + "<br>"
) )
for n in Reply.objects.all(): for n in Reply.objects.all():
if n.reply_to == i: if n.forum_post == i:
return_string+=( return_string+=(
"Reply by " + n.author + " posted " + n.datetime_posted() + ":<br>" "Reply by " + n.author + " posted " + n.datetime_posted() + ":<br>"
+ n.body + "<br>" + n.body + "<br>"
......
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