Sith/election/migrations/0001_initial.py

225 lines
7.5 KiB
Python
Raw Permalink Normal View History

2016-12-25 23:56:22 +00:00
from __future__ import unicode_literals
import django.db.models.deletion
2024-06-24 11:07:36 +00:00
from django.conf import settings
from django.db import migrations, models
2016-12-25 23:56:22 +00:00
class Migration(migrations.Migration):
dependencies = [
2018-10-04 19:29:19 +00:00
("core", "0018_auto_20161224_0211"),
2016-12-25 23:56:22 +00:00
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
2018-10-04 19:29:19 +00:00
name="Candidature",
2016-12-25 23:56:22 +00:00
fields=[
2018-10-04 19:29:19 +00:00
(
"id",
models.AutoField(
primary_key=True,
verbose_name="ID",
serialize=False,
auto_created=True,
),
),
(
"program",
models.TextField(null=True, verbose_name="description", blank=True),
),
2016-12-25 23:56:22 +00:00
],
),
migrations.CreateModel(
2018-10-04 19:29:19 +00:00
name="Election",
2016-12-25 23:56:22 +00:00
fields=[
2018-10-04 19:29:19 +00:00
(
"id",
models.AutoField(
primary_key=True,
verbose_name="ID",
serialize=False,
auto_created=True,
),
),
("title", models.CharField(max_length=255, verbose_name="title")),
(
"description",
models.TextField(null=True, verbose_name="description", blank=True),
),
(
"start_candidature",
models.DateTimeField(verbose_name="start candidature"),
),
(
"end_candidature",
models.DateTimeField(verbose_name="end candidature"),
),
("start_date", models.DateTimeField(verbose_name="start date")),
("end_date", models.DateTimeField(verbose_name="end date")),
(
"candidature_groups",
models.ManyToManyField(
related_name="candidate_elections",
verbose_name="candidature groups",
blank=True,
to="core.Group",
),
),
(
"edit_groups",
models.ManyToManyField(
related_name="editable_elections",
verbose_name="edit groups",
blank=True,
to="core.Group",
),
),
(
"view_groups",
models.ManyToManyField(
related_name="viewable_elections",
verbose_name="view groups",
blank=True,
to="core.Group",
),
),
(
"vote_groups",
models.ManyToManyField(
related_name="votable_elections",
verbose_name="vote groups",
blank=True,
to="core.Group",
),
),
(
"voters",
models.ManyToManyField(
related_name="voted_elections",
verbose_name="voters",
to=settings.AUTH_USER_MODEL,
),
),
2016-12-25 23:56:22 +00:00
],
),
migrations.CreateModel(
2018-10-04 19:29:19 +00:00
name="ElectionList",
2016-12-25 23:56:22 +00:00
fields=[
2018-10-04 19:29:19 +00:00
(
"id",
models.AutoField(
primary_key=True,
verbose_name="ID",
serialize=False,
auto_created=True,
),
),
("title", models.CharField(max_length=255, verbose_name="title")),
(
"election",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
2018-10-04 19:29:19 +00:00
verbose_name="election",
to="election.Election",
related_name="election_lists",
),
),
2016-12-25 23:56:22 +00:00
],
),
migrations.CreateModel(
2018-10-04 19:29:19 +00:00
name="Role",
2016-12-25 23:56:22 +00:00
fields=[
2018-10-04 19:29:19 +00:00
(
"id",
models.AutoField(
primary_key=True,
verbose_name="ID",
serialize=False,
auto_created=True,
),
),
("title", models.CharField(max_length=255, verbose_name="title")),
(
"description",
models.TextField(null=True, verbose_name="description", blank=True),
),
(
"max_choice",
models.IntegerField(verbose_name="max choice", default=1),
),
(
"election",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
2018-10-04 19:29:19 +00:00
verbose_name="election",
to="election.Election",
related_name="roles",
),
),
2016-12-25 23:56:22 +00:00
],
),
migrations.CreateModel(
2018-10-04 19:29:19 +00:00
name="Vote",
2016-12-25 23:56:22 +00:00
fields=[
2018-10-04 19:29:19 +00:00
(
"id",
models.AutoField(
primary_key=True,
verbose_name="ID",
serialize=False,
auto_created=True,
),
),
(
"candidature",
models.ManyToManyField(
related_name="votes",
verbose_name="candidature",
to="election.Candidature",
),
),
(
"role",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
verbose_name="role",
to="election.Role",
related_name="votes",
2018-10-04 19:29:19 +00:00
),
),
2016-12-25 23:56:22 +00:00
],
),
migrations.AddField(
2018-10-04 19:29:19 +00:00
model_name="candidature",
name="election_list",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
2018-10-04 19:29:19 +00:00
verbose_name="election list",
to="election.ElectionList",
related_name="candidatures",
),
2016-12-25 23:56:22 +00:00
),
migrations.AddField(
2018-10-04 19:29:19 +00:00
model_name="candidature",
name="role",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
verbose_name="role",
to="election.Role",
related_name="candidatures",
2018-10-04 19:29:19 +00:00
),
2016-12-25 23:56:22 +00:00
),
migrations.AddField(
2018-10-04 19:29:19 +00:00
model_name="candidature",
name="user",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
2018-10-04 19:29:19 +00:00
verbose_name="user",
to=settings.AUTH_USER_MODEL,
related_name="candidates",
blank=True,
),
2016-12-25 23:56:22 +00:00
),
]