Simplify models
This commit is contained in:
parent
f3920957eb
commit
b7a0d41db2
1 changed files with 12 additions and 18 deletions
|
@ -17,31 +17,25 @@ class Election(models.Model):
|
|||
User, on_delete=models.SET_NULL, blank=True, null=True
|
||||
)
|
||||
|
||||
counted = models.BooleanField(_("dépouillée"), default=False)
|
||||
results_public = models.BooleanField(_("résultats publics"), default=False)
|
||||
tallied = models.BooleanField(_("dépouillée"), default=False)
|
||||
|
||||
archived = models.BooleanField(_("archivée"), default=False)
|
||||
|
||||
|
||||
class Question(models.Model):
|
||||
election = models.ForeignKey(Election, on_delete=models.CASCADE)
|
||||
election = models.ForeignKey(
|
||||
Election, related_name="questions", on_delete=models.CASCADE
|
||||
)
|
||||
text = models.TextField(_("question"), blank=False)
|
||||
|
||||
# TODO: add voting type
|
||||
|
||||
|
||||
class Option(models.Model):
|
||||
question = models.ForeignKey(Question, on_delete=models.CASCADE)
|
||||
question = models.ForeignKey(
|
||||
Question, related_name="options", on_delete=models.CASCADE
|
||||
)
|
||||
text = models.TextField(_("texte"), blank=False)
|
||||
|
||||
|
||||
class Vote(models.Model):
|
||||
question = models.ForeignKey(Question, on_delete=models.CASCADE)
|
||||
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||
votes = models.ManyToManyField(Option, through="OptionVote")
|
||||
|
||||
|
||||
class OptionVote(models.Model):
|
||||
vote = models.ForeignKey(Vote, on_delete=models.CASCADE)
|
||||
option = models.ForeignKey(Option, on_delete=models.CASCADE)
|
||||
# Préparation pour condorcet ?
|
||||
ranking = models.PositiveSmallIntegerField(_("rang"), default=0)
|
||||
voters = models.ManyToManyField(
|
||||
User,
|
||||
related_name="votes",
|
||||
)
|
Loading…
Reference in a new issue