summaryrefslogtreecommitdiff
path: root/postgresqleu/elections/migrations/0001_initial.py
blob: 432b63e9e527219026a2d95a1ff8b12f0af41e99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models
from postgresqleu.util.fields import LowercaseEmailField


class Migration(migrations.Migration):

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Candidate',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('name', models.CharField(max_length=100)),
                ('email', LowercaseEmailField(max_length=200)),
                ('presentation', models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name='Election',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('name', models.CharField(max_length=100)),
                ('startdate', models.DateField(verbose_name='Start date')),
                ('enddate', models.DateField(verbose_name='End date')),
                ('slots', models.IntegerField(default=1)),
                ('isopen', models.BooleanField(default=False, verbose_name="Voting open")),
                ('resultspublic', models.BooleanField(default=False, verbose_name="Results public")),
            ],
            options={
                'ordering': ('-startdate',),
            },
        ),
        migrations.CreateModel(
            name='Vote',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('score', models.IntegerField()),
                ('candidate', models.ForeignKey(to='elections.Candidate', on_delete=models.CASCADE)),
                ('election', models.ForeignKey(to='elections.Election', on_delete=models.CASCADE)),
            ],
        ),
    ]