Commit 37450f76 authored by justin's avatar justin

Added forum admin inlining and renamed 'forum' field to 'forum_post'

parent a2ca8101
......@@ -2,6 +2,10 @@ from django.contrib import admin
from .models import ForumPost, Reply
class ReplyInline(admin.TabularInline):
model = Reply
class ForumPostAdmin(admin.ModelAdmin):
model = ForumPost
......@@ -11,7 +15,7 @@ class ForumPostAdmin(admin.ModelAdmin):
class ReplyAdmin(admin.ModelAdmin):
model = Reply
list_display = ("forum", "author", "body", "pub_datetime")
list_display = ("forum_post", "author", "body", "pub_datetime")
admin.site.register(ForumPost, ForumPostAdmin)
......
# Generated by Django 4.1.7 on 2023-03-06 04:27
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('forum', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='reply',
old_name='forum',
new_name='forum_post',
),
]
......@@ -3,7 +3,6 @@ from dashboard.models import WidgetUser
class ForumPost(models.Model):
title = models.CharField(max_length=50)
body = models.CharField(max_length=1000)
author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE)
......@@ -14,7 +13,7 @@ class ForumPost(models.Model):
class Reply(models.Model):
forum = models.ForeignKey(ForumPost, on_delete=models.CASCADE)
forum_post = models.ForeignKey(ForumPost, on_delete=models.CASCADE)
body = models.CharField(max_length=1000)
author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE)
pub_datetime = models.DateTimeField("Published Date and Time", auto_now_add=True)
......
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