kadenios/elections/migrations/0001_initial.py

50 lines
2.4 KiB
Python
Raw Normal View History

2020-11-20 17:45:15 +01:00
# Generated by Django 2.2.17 on 2020-11-20 15:31
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Election',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255, verbose_name='nom')),
('short_name', models.SlugField(unique=True, verbose_name='nom bref')),
('description', models.TextField(blank=True, verbose_name='description')),
('start_time', models.DateTimeField(verbose_name='date et heure de début')),
('end_time', models.DateTimeField(verbose_name='date et heure de fin')),
('results_public', models.BooleanField(default=False, verbose_name='résultats publics')),
('tallied', models.BooleanField(default=False, verbose_name='dépouillée')),
('archived', models.BooleanField(default=False, verbose_name='archivée')),
('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Question',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('text', models.TextField(verbose_name='question')),
('election', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='questions', to='elections.Election')),
],
),
migrations.CreateModel(
name='Option',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('text', models.TextField(verbose_name='texte')),
('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='options', to='elections.Question')),
('voters', models.ManyToManyField(related_name='votes', to=settings.AUTH_USER_MODEL)),
],
),
]