Commit a4affa42 authored by justin's avatar justin

Fixed admin.py and models.py formatting

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