Commit 018befb1 authored by Joshua Son's avatar Joshua Son

Added the announcement text and reactions

parent da24b0ae
from django.apps import AppConfig from django.apps import AppConfig
class AnnoucementsConfig(AppConfig): class AnnouncementsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField' default_auto_field = 'django.db.models.BigAutoField'
name = 'annoucements' name = 'announcements'
# Generated by Django 3.2.12 on 2022-03-28 09:37
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Announcement',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('announcement_title', models.CharField(max_length=50)),
('announcement_body', models.CharField(max_length=500)),
('pub_date', models.DateTimeField(verbose_name='date published')),
],
),
]
# Generated by Django 3.2.12 on 2022-03-28 10:14
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('announcements', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Reaction',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('reaction_name', models.CharField(choices=[('LV', 'Love'), ('LK', 'Like'), ('AG', 'Angry'), ('SD', 'Sad')], max_length=2)),
('tally', models.IntegerField(default=0)),
('announcement', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='announcements.announcement')),
],
),
]
# Generated by Django 3.2.12 on 2022-03-28 10:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('announcements', '0002_reaction'),
]
operations = [
migrations.AlterField(
model_name='reaction',
name='reaction_name',
field=models.CharField(max_length=10),
),
]
from django.db import models from django.db import models
# Create your models here. # Create your models here.
class Announcement(models.Model):
announcement_title = models.CharField(max_length=50)
announcement_body = models.CharField(max_length=500)
pub_date = models.DateTimeField("date published")
def __str__(self):
return self.announcement_title
class Reaction(models.Model):
announcement = models.ForeignKey(Announcement, on_delete=models.CASCADE)
reaction_name = models.CharField(max_length=10)
tally = models.IntegerField(default=0)
def __str__(self):
return self.reaction_name
\ No newline at end of file
...@@ -35,6 +35,7 @@ ALLOWED_HOSTS = [] ...@@ -35,6 +35,7 @@ ALLOWED_HOSTS = []
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
'announcements.apps.AnnouncementsConfig',
'homepage.apps.HomepageConfig', 'homepage.apps.HomepageConfig',
'django.contrib.admin', 'django.contrib.admin',
'django.contrib.auth', 'django.contrib.auth',
......
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