diff --git a/elections/forms.py b/elections/forms.py index 9682e81..e1b3b58 100644 --- a/elections/forms.py +++ b/elections/forms.py @@ -22,7 +22,18 @@ class ElectionForm(forms.ModelForm): class Meta: model = Election - fields = ["name", "description", "restricted", "start_date", "end_date"] + fields = [ + "name", + "description", + "vote_restrictions", + "restricted", + "start_date", + "end_date", + ] + widgets = { + "description": forms.Textarea(attrs={"rows": 4}), + "vote_restrictions": forms.Textarea(attrs={"rows": 4}), + } class UploadVotersForm(forms.Form): diff --git a/elections/migrations/0021_election_vote_restrictions.py b/elections/migrations/0021_election_vote_restrictions.py new file mode 100644 index 0000000..6a090eb --- /dev/null +++ b/elections/migrations/0021_election_vote_restrictions.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2 on 2021-04-13 23:41 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("elections", "0020_alter_user_first_name"), + ] + + operations = [ + migrations.AddField( + model_name="election", + name="vote_restrictions", + field=models.TextField(blank=True, verbose_name="conditions de vote"), + ), + ] diff --git a/elections/models.py b/elections/models.py index a1704fc..3d07664 100644 --- a/elections/models.py +++ b/elections/models.py @@ -32,6 +32,8 @@ class Election(models.Model): start_date = models.DateTimeField(_("date et heure de début")) end_date = models.DateTimeField(_("date et heure de fin")) + vote_restrictions = models.TextField(_("conditions de vote"), blank=True) + restricted = models.BooleanField( _("restreint le vote à une liste de personnes"), default=True ) diff --git a/elections/templates/elections/election.html b/elections/templates/elections/election.html index e0cc7ed..b71a54b 100644 --- a/elections/templates/elections/election.html +++ b/elections/templates/elections/election.html @@ -86,6 +86,13 @@