Commit 101a7e78 authored by Michael Lopez's avatar Michael Lopez

Added Announcement and Reaction models on Announcements app

parent dad9906f
from django.db import models from django.db import models
from .models import WidgetUser
class Announcement(models.Model):
title = models.CharField(max_length=50)
body = models.TextField(max_length=1024)
author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE)
pub_datetime = models.DateTimeField()
def __str__(self):
return self.title
class Reaction(models.Model):
LIKE = 'like'
LOVE = 'love'
ANGR = 'angry'
namechoices = [
(LIKE, 'Like'),
(LOVE, 'Love'),
(ANGR, 'Angry')
]
name = models.CharField(
max_length=4,
choices=namechoices,
default=LIKE
)
tally = models.IntegerField()
announcement = models.ForeignKey(Announcement, on_delete=models.CASCADE)
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