Commit 291cfb3d authored by Cherish Magpayo's avatar Cherish Magpayo

Added author field in Announcement model and Reaction model

parent 57a86bb8
from django.db import models
from homepage.models import WidgetUser
# Create your models here.
class Announcement(models.Model):
announcement_title = models.CharField(max_length=50)
announcement_body = models.CharField(max_length=500)
pub_date = models.DateTimeField("date published")
pub_date = models.DateTimeField(auto_now_add=True)
author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE, default=1)
def __str__(self):
return self.announcement_title
class Reaction(models.Model):
reaction_choices = [
('LIKE', 'Like'),
('LOVE', 'Love'),
('ANGRY', 'Angry')
]
announcement = models.ForeignKey(Announcement, on_delete=models.CASCADE)
reaction_name = models.CharField(max_length=15, choices=reaction_choices)
tally = models.IntegerField(default=0)
def __str__(self):
return self.reaction_name
\ No newline at end of file
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