Commit 62530d3d authored by Nics De Vega's avatar Nics De Vega

implemented models of app announcement_board

parent c0e3e259
from django.db import models from django.db import models
from dashboard.models import WidgetUser
class Announcement(models.Model):
title = models.CharField(max_length=100,default="")
body = models.TextField(default="")
author = models.CharField(max_length=100, unique=True,default="")
author = models.ForeignKey(WidgetUser,on_delete=models.CASCADE)
pub_datetime = models.DateTimeField()
def __str__(self):
return '{} by {}'.format(self.title, self.author)
class Reaction(models.Model):
name = models.CharField(max_length=20,default="")
reactions = [('Like','Like'),
("Love", 'Love'),
('Angry', 'Angry')
]
name = models.CharField(choices=reactions,max_length=6)
tally = models.IntegerField(default=0)
announcement = models.ForeignKey(Announcement,on_delete=models.CASCADE)
def __str__(self):
return '{} reaction in "{}"'.format(self.name, self.announcement.title)
# Create your models here.
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