Commit 3df59488 authored by Jan Enzo Salvador's avatar Jan Enzo Salvador

Created models for the forum app

parent aa888c8e
from django.db import models from django.db import models
from dashboard.models import WidgetUser
# Create your models here. class ForumPost(models.Model):
title = models.CharField(max_length = 50)
body = models.TextField(max_length = 1000)
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):
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)
forum_post = models.ForeignKey(ForumPost, on_delete=models.CASCADE)
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