Commit add322b7 authored by nheoxoz's avatar nheoxoz

updated models.py using dashboard.models

parent 8848e08d
from django.db import models from django.db import models
from dashboard.models import WidgetUser
class Announcement(models.Model): class Announcement(models.Model):
...@@ -6,10 +7,17 @@ class Announcement(models.Model): ...@@ -6,10 +7,17 @@ class Announcement(models.Model):
body = models.TextField() body = models.TextField()
author = models.CharField(max_length=100) author = models.CharField(max_length=100)
pub_datetime = models.DateTimeField() pub_datetime = models.DateTimeField()
first_name = models.ForeignKey(WidgetUser, on_delete=models.CASCADE)
last_name = models.ForeignKey(WidgetUser, on_delete=models.CASCADE)
def __str__(self): def __str__(self):
return '''{} by <authors first name> <authors last name> published {} return '''{} by {} {} published {}\n{}'''.format(
\n{}'''.format(self.title, self.pub_datetime, self.body) self.title,
self.first_name,
self.last_name,
self.pub_datetime,
self.body,
)
class Reaction(models.Model): class Reaction(models.Model):
...@@ -32,4 +40,8 @@ class Reaction(models.Model): ...@@ -32,4 +40,8 @@ class Reaction(models.Model):
announcement = models.ForeignKey(Announcement, on_delete=models.CASCADE) announcement = models.ForeignKey(Announcement, on_delete=models.CASCADE)
def __str__(self): def __str__(self):
return '''Like: {}\nLove: {}\nAngry: {}'''.format(self.tally, self.tally, self.tally) return '''Like: {}\nLove: {}\nAngry: {}'''.format(
self.tally,
self.tally,
self.tally,
)
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