Commit 9f2f14a0 authored by Bianca Aguilar's avatar Bianca Aguilar

Created Announcements models

parent d8a574ab
# Generated by Django 4.0.3 on 2022-04-05 06:41
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('homepage', '0003_widgetuser_department'),
('announcements', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='announcement',
name='author',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='homepage.widgetuser'),
preserve_default=False,
),
migrations.CreateModel(
name='Reaction',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('tally', models.IntegerField()),
('announcement', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='announcements.announcement')),
],
),
]
...@@ -6,3 +6,19 @@ class Announcement(models.Model): ...@@ -6,3 +6,19 @@ class Announcement(models.Model):
announcement_title = models.CharField(max_length=50) announcement_title = models.CharField(max_length=50)
announcement_body = models.CharField(max_length=500) announcement_body = models.CharField(max_length=500)
pub_date = models.DateTimeField("Date Published", auto_now=True) pub_date = models.DateTimeField("Date Published", auto_now=True)
author = models.ForeignKey(
'homepage.WidgetUser',
on_delete=models.CASCADE
)
class Reaction(models.Model):
reaction_name = [
('Like', 'Like'),
('Love', 'Love'),
('Angry', 'Angry'),
]
tally = models.IntegerField()
announcement = models.ForeignKey(
Announcement,
on_delete=models.CASCADE
)
\ No newline at end of file
No preview for this file type
from django.db import models from django.db import models
from django.urls import reverse
from homepage.models import WidgetUser from homepage.models import WidgetUser
......
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