diff --git a/elections/migrations/0019_option_winner.py b/elections/migrations/0019_option_winner.py new file mode 100644 index 0000000..b0141e9 --- /dev/null +++ b/elections/migrations/0019_option_winner.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.19 on 2021-04-04 16:31 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("elections", "0018_auto_20210331_1317"), + ] + + operations = [ + migrations.AddField( + model_name="option", + name="winner", + field=models.BooleanField(default=False, verbose_name="option gagnante"), + ), + ] diff --git a/elections/models.py b/elections/models.py index 47cfe7d..f7a6671 100644 --- a/elections/models.py +++ b/elections/models.py @@ -123,6 +123,7 @@ class Option(models.Model): ) text = models.TextField(_("texte"), blank=False) + winner = models.BooleanField(_("option gagnante"), default=False) voters = models.ManyToManyField( settings.AUTH_USER_MODEL, related_name="votes", diff --git a/elections/templates/elections/election.html b/elections/templates/elections/election.html index 59c3e26..3c1ef36 100644 --- a/elections/templates/elections/election.html +++ b/elections/templates/elections/election.html @@ -135,23 +135,22 @@ {% for o in q.options.all %}