Use blank=True for voters
This commit is contained in:
parent
f782b7402d
commit
aa713a5aa7
2 changed files with 31 additions and 0 deletions
28
elections/migrations/0010_blank_voters.py
Normal file
28
elections/migrations/0010_blank_voters.py
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
# Generated by Django 2.2.19 on 2021-03-18 13:48
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("elections", "0009_auto_20210318_1441"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="election",
|
||||||
|
name="voters",
|
||||||
|
field=models.ManyToManyField(
|
||||||
|
blank=True, related_name="cast_elections", to=settings.AUTH_USER_MODEL
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="question",
|
||||||
|
name="voters",
|
||||||
|
field=models.ManyToManyField(
|
||||||
|
blank=True, related_name="cast_questions", to=settings.AUTH_USER_MODEL
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
|
@ -37,6 +37,7 @@ class Election(models.Model):
|
||||||
voters = models.ManyToManyField(
|
voters = models.ManyToManyField(
|
||||||
settings.AUTH_USER_MODEL,
|
settings.AUTH_USER_MODEL,
|
||||||
related_name="cast_elections",
|
related_name="cast_elections",
|
||||||
|
blank=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
results_public = models.BooleanField(_("résultats publics"), default=False)
|
results_public = models.BooleanField(_("résultats publics"), default=False)
|
||||||
|
@ -67,6 +68,7 @@ class Question(models.Model):
|
||||||
voters = models.ManyToManyField(
|
voters = models.ManyToManyField(
|
||||||
settings.AUTH_USER_MODEL,
|
settings.AUTH_USER_MODEL,
|
||||||
related_name="cast_questions",
|
related_name="cast_questions",
|
||||||
|
blank=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -82,6 +84,7 @@ class Option(models.Model):
|
||||||
settings.AUTH_USER_MODEL,
|
settings.AUTH_USER_MODEL,
|
||||||
related_name="votes",
|
related_name="votes",
|
||||||
through="Vote",
|
through="Vote",
|
||||||
|
blank=True,
|
||||||
)
|
)
|
||||||
# For now, we store the amount of votes received after the election is tallied
|
# For now, we store the amount of votes received after the election is tallied
|
||||||
nb_votes = models.PositiveSmallIntegerField(_("nombre de votes reçus"), default=0)
|
nb_votes = models.PositiveSmallIntegerField(_("nombre de votes reçus"), default=0)
|
||||||
|
|
Loading…
Reference in a new issue