Commit da3fa767 authored by Joshua Son's avatar Joshua Son

Fix: added author to announcement

parent e6ceea29
# Generated by Django 3.2.12 on 2022-04-06 05:00
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('homepage', '0003_rename_id_name_widgetuser_id_num'),
('announcements', '0014_alter_reaction_reaction_self'),
]
operations = [
migrations.AddField(
model_name='announcement',
name='author',
field=models.ForeignKey(blank=True, default=1, on_delete=django.db.models.deletion.CASCADE, to='homepage.widgetuser'),
),
]
# Generated by Django 3.2.12 on 2022-04-06 05:01
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('homepage', '0003_rename_id_name_widgetuser_id_num'),
('announcements', '0015_announcement_author'),
]
operations = [
migrations.AlterField(
model_name='announcement',
name='author',
field=models.ForeignKey(blank=True, default=1, on_delete=django.db.models.deletion.CASCADE, to='homepage.widgetuser'),
),
]
...@@ -3,6 +3,7 @@ from django.db import models ...@@ -3,6 +3,7 @@ from django.db import models
# Create your models here. # Create your models here.
class Announcement(models.Model): class Announcement(models.Model):
author = models.ForeignKey('homepage.WidgetUser', on_delete=models.CASCADE, blank=True, default=1)
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") pub_date = models.DateTimeField("date published")
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<h2>ANNOUNCEMENTS: </h2> <h2>ANNOUNCEMENTS: </h2>
{% for announcement in announcements%} {% for announcement in announcements%}
<p><b>{{announcement.announcement_title}}</b> dated {{announcement.pub_date}}</p> <p><b>{{announcement.announcement_title}}</b> by {{announcement.author}} dated {{announcement.pub_date}}</p>
<p>{{announcement.announcement_body}}</p> <p>{{announcement.announcement_body}}</p>
......
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