Commit 2265bf51 authored by Lance Cedric Tan's avatar Lance Cedric Tan

Updated models to use proper ForeignKeys

parent c0279273
from django.db import models from django.db import models
from dashboard.models import WidgetUser
class ForumPost(models.Model): class ForumPost(models.Model):
title = models.CharField(max_length=100) title = models.CharField(max_length=100)
body = models.TextField() body = models.TextField()
author = models.CharField(max_length=50) #To be updated after Dashboard implementation author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE)
pub_datetime = models.DateTimeField() pub_datetime = models.DateTimeField()
def __str__(self): def __str__(self):
...@@ -12,6 +14,7 @@ class ForumPost(models.Model): ...@@ -12,6 +14,7 @@ class ForumPost(models.Model):
class Reply(models.Model): class Reply(models.Model):
post = models.ForeignKey(ForumPost, on_delete=models.CASCADE)
body = models.TextField() body = models.TextField()
author = models.CharField(max_length=50) #To be updated after Dashboard implementation author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE)
pub_datetime = models.DateTimeField() pub_datetime = models.DateTimeField()
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