Updated models.py file

parent 59d7b2c4
from django.db import models from django.db import models
from django.utils import timezone
#from dashboard.models import WidgetUser
# Create your models here. Like = 'Like'
Love = 'Love'
Angry = 'Angry'
REACTIONS = ((Like, 'Like'), (Love, 'Love'), (Angry, 'Angry'))
class Announcement(models.Model):
title = models.CharField(max_length=50)
body = models.CharField(max_length=500)
author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE, null=True, blank=True, default=None)
pub_datetime = models.DateTimeField("date published", default=timezone.now, null=True)
def __str__(self):
return self.title
class Reaction(models.Model):
name = models.CharField(max_length=10, choices=REACTIONS, default=Like)
tally = models.IntegerField(default = 0)
announcement = models.ForeignKey(Announcement, on_delete = models.CASCADE)
def __str__(self):
return self.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