Commit e6ceea29 authored by Joshua Son's avatar Joshua Son

Fix: reactions now properly show

parent a2ad7f3b
# Generated by Django 3.2.12 on 2022-04-05 15:06
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('announcements', '0008_announcement_reaction_list'),
]
operations = [
migrations.AddField(
model_name='reaction',
name='reaction_self',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='announcements.reaction'),
),
]
# Generated by Django 3.2.12 on 2022-04-05 15:13
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('announcements', '0009_reaction_reaction_self'),
]
operations = [
migrations.AlterField(
model_name='reaction',
name='reaction_self',
field=models.ForeignKey(default=1, null=True, on_delete=django.db.models.deletion.CASCADE, to='announcements.reaction'),
),
]
# Generated by Django 3.2.12 on 2022-04-05 15:29
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('announcements', '0010_alter_reaction_reaction_self'),
]
operations = [
migrations.RemoveField(
model_name='announcement',
name='reaction_list',
),
]
# Generated by Django 3.2.12 on 2022-04-05 15:30
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('announcements', '0011_remove_announcement_reaction_list'),
]
operations = [
migrations.RemoveField(
model_name='reaction',
name='reaction_self',
),
]
# Generated by Django 3.2.12 on 2022-04-05 15:31
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('announcements', '0012_remove_reaction_reaction_self'),
]
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'),
),
migrations.AddField(
model_name='reaction',
name='reaction_self',
field=models.ForeignKey(default=1, null=True, on_delete=django.db.models.deletion.CASCADE, to='announcements.reaction'),
),
]
# Generated by Django 3.2.12 on 2022-04-05 15:39
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('announcements', '0013_auto_20220405_2331'),
]
operations = [
migrations.AlterField(
model_name='reaction',
name='reaction_self',
field=models.ForeignKey(blank=True, default=1, null=True, on_delete=django.db.models.deletion.CASCADE, to='announcements.reaction'),
),
]
...@@ -14,6 +14,7 @@ class Announcement(models.Model): ...@@ -14,6 +14,7 @@ class Announcement(models.Model):
class Reaction(models.Model): class Reaction(models.Model):
announcement = models.ForeignKey('Announcement', on_delete=models.CASCADE, related_name='+') announcement = models.ForeignKey('Announcement', on_delete=models.CASCADE, related_name='+')
reaction_self = models.ForeignKey('Reaction', on_delete=models.CASCADE, default =1, null=True, blank=True)
reaction_name = models.CharField(max_length=10) reaction_name = models.CharField(max_length=10)
tally = models.IntegerField(default=0) tally = models.IntegerField(default=0)
......
<p> <p>
<p>{{ reaction.reaction_name }} : {{reaction.tally}} </p> <p>{{ reactions.reaction_name }} : {{reactions.tally}}</p>
{% if reactions.reaction_self != NULL %}
<p>{% include "reactions_list.html" with reactions=reactions.reaction_self %}</p>
{% endif %}
{{ value|linebreaks }}
</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