Commit d4420443 authored by Joshua Son's avatar Joshua Son

Fix: Now displays the colon for reactions

parent 946e836b
# Generated by Django 3.2.12 on 2022-04-05 14:15
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('announcements', '0003_alter_reaction_reaction_name'),
]
operations = [
migrations.AddField(
model_name='announcement',
name='reaction_list',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='announcements.reaction'),
preserve_default=False,
),
migrations.AlterField(
model_name='reaction',
name='announcement',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='announcements.announcement'),
),
]
# Generated by Django 3.2.12 on 2022-04-05 14:17
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('announcements', '0004_auto_20220405_2215'),
]
operations = [
migrations.AlterField(
model_name='announcement',
name='reaction_list',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='announcements.reaction'),
),
]
# Generated by Django 3.2.12 on 2022-04-05 14:23
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('announcements', '0005_alter_announcement_reaction_list'),
]
operations = [
migrations.AlterField(
model_name='announcement',
name='reaction_list',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='announcements.reaction'),
),
]
# Generated by Django 3.2.12 on 2022-04-05 14:24
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('announcements', '0006_alter_announcement_reaction_list'),
]
operations = [
migrations.RemoveField(
model_name='announcement',
name='reaction_list',
),
]
# Generated by Django 3.2.12 on 2022-04-05 14:26
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('announcements', '0007_remove_announcement_reaction_list'),
]
operations = [
migrations.AddField(
model_name='announcement',
name='reaction_list',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='announcements.reaction'),
),
]
from email.policy import default
from django.db import models from django.db import models
# Create your models here. # Create your models here.
...@@ -5,13 +6,14 @@ class Announcement(models.Model): ...@@ -5,13 +6,14 @@ 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") pub_date = models.DateTimeField("date published")
reaction_list = models.ForeignKey('Reaction', on_delete=models.CASCADE, related_name='+', default=1)
def __str__(self): def __str__(self):
return self.announcement_title return self.announcement_title
class Reaction(models.Model): class Reaction(models.Model):
announcement = models.ForeignKey('Announcement', on_delete=models.CASCADE) announcement = models.ForeignKey('Announcement', on_delete=models.CASCADE, related_name='+')
reaction_name = models.CharField(max_length=10) reaction_name = models.CharField(max_length=10)
tally = models.IntegerField(default=0) tally = models.IntegerField(default=0)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<p>{{announcement.announcement_body}}</p> <p>{{announcement.announcement_body}}</p>
<p>{% include "reactions_list.html" with reactions=reaction.announcement %}</p> <p>{% include "reactions_list.html" with reactions=announcement.reaction_list %}</p>
{{ value|linebreaks }} {{ value|linebreaks }}
......
<p> <p>
{% for reaction in reactions %}
<p>{{ reaction.reaction_name }} : {{reaction.tally}} </p> <p>{{ reaction.reaction_name }} : {{reaction.tally}} </p>
{{ value|linebreaks }} {{ value|linebreaks }}
{% endfor %}
</p> </p>
\ No newline at end of file
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