Commit a4affa42 authored by justin's avatar justin

Fixed admin.py and models.py formatting

parent 030df003
from django.contrib import admin
# Register your models here.
from .models import ForumPost, Reply
class ForumPostAdmin(admin.ModelAdmin):
model = ForumPost
list_display = ('title', 'author', 'body','pub_datetime')
list_display = ("title", "author", "body", "pub_datetime")
class ReplyAdmin(admin.ModelAdmin):
model = Reply
list_display = ('forum', 'author', 'body','pub_datetime')
list_display = ("forum", "author", "body", "pub_datetime")
admin.site.register(ForumPost, ForumPostAdmin)
admin.site.register(Reply, ReplyAdmin)
\ No newline at end of file
admin.site.register(Reply, ReplyAdmin)
from django.db import models
# if need to import WidgetUser
# from widget_casanatics.dashboard.models import WidgetUser
from dashboard.models import WidgetUser
# Create your models here.
class ForumPost(models.Model):
title = models.CharField(max_length=50)
body = models.CharField(max_length=1000)
author = models.CharField(max_length = 100)
# If connecting to WidgetUser
# author = models.ForeignKey(WidgetUser, on_delete = models.CASCADE)
pub_datetime = models.DateTimeField("Published Date and Time")
author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE)
pub_datetime = models.DateTimeField("Published Date and Time", auto_now_add=True)
def __str__(self):
return self.title
class Reply(models.Model):
forum = models.ForeignKey(ForumPost, on_delete = models.CASCADE)
forum = models.ForeignKey(ForumPost, on_delete=models.CASCADE)
body = models.CharField(max_length=1000)
author = models.CharField(max_length = 100)
# If connecting to WidgetUser
# author = models.ForeignKey(WidgetUser, on_delete = models.CASCADE)
pub_datetime = models.DateTimeField("Published Date and Time")
author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE)
pub_datetime = models.DateTimeField("Published Date and Time", auto_now_add=True)
def __str__(self):
return self.body
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