OpenSlides/openslides/assignments/migrations/0001_initial.py

119 lines
5.3 KiB
Python
Raw Normal View History

2016-03-02 01:29:47 +01:00
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-03-02 01:22
from __future__ import unicode_literals
import django.db.models.deletion
2015-06-29 13:23:19 +02:00
from django.conf import settings
from django.db import migrations, models
import openslides.utils.models
class Migration(migrations.Migration):
2016-03-02 01:29:47 +01:00
initial = True
2015-06-29 13:23:19 +02:00
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
2016-01-09 18:49:38 +01:00
('core', '0001_initial'),
2015-06-29 13:23:19 +02:00
]
operations = [
migrations.CreateModel(
name='Assignment',
fields=[
2016-03-02 01:29:47 +01:00
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
2016-01-09 18:49:38 +01:00
('title', models.CharField(max_length=100)),
('description', models.TextField(blank=True)),
('open_posts', models.PositiveSmallIntegerField()),
('poll_description_default', models.CharField(blank=True, max_length=79)),
('phase', models.IntegerField(choices=[(0, 'Searching for candidates'), (1, 'Voting'), (2, 'Finished')], default=0)),
2015-06-29 13:23:19 +02:00
],
options={
2016-01-09 18:49:38 +01:00
'verbose_name': 'Election',
'default_permissions': (),
2016-03-02 01:29:47 +01:00
'permissions': (
('can_see', 'Can see elections'),
('can_nominate_other', 'Can nominate another participant'),
('can_nominate_self', 'Can nominate oneself'),
('can_manage', 'Can manage elections')),
'ordering': ('title',),
2015-06-29 13:23:19 +02:00
},
bases=(openslides.utils.models.RESTModelMixin, models.Model),
),
migrations.CreateModel(
name='AssignmentOption',
fields=[
2016-03-02 01:29:47 +01:00
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('candidate', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
2015-06-29 13:23:19 +02:00
],
options={
2016-01-09 18:49:38 +01:00
'default_permissions': (),
2015-06-29 13:23:19 +02:00
},
bases=(openslides.utils.models.RESTModelMixin, models.Model),
),
migrations.CreateModel(
name='AssignmentPoll',
fields=[
2016-03-02 01:29:47 +01:00
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('votesvalid', openslides.utils.models.MinMaxIntegerField(blank=True, null=True)),
('votesinvalid', openslides.utils.models.MinMaxIntegerField(blank=True, null=True)),
('votescast', openslides.utils.models.MinMaxIntegerField(blank=True, null=True)),
2015-06-29 13:23:19 +02:00
('published', models.BooleanField(default=False)),
('yesnoabstain', models.BooleanField(default=False)),
2016-01-09 18:49:38 +01:00
('description', models.CharField(blank=True, max_length=79)),
2016-03-02 01:29:47 +01:00
('assignment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='polls', to='assignments.Assignment')),
2015-06-29 13:23:19 +02:00
],
options={
2016-01-09 18:49:38 +01:00
'default_permissions': (),
2015-06-29 13:23:19 +02:00
},
bases=(openslides.utils.models.RESTModelMixin, models.Model),
),
migrations.CreateModel(
name='AssignmentRelatedUser',
fields=[
2016-03-02 01:29:47 +01:00
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
2016-01-09 18:49:38 +01:00
('elected', models.BooleanField(default=False)),
2016-03-02 01:29:47 +01:00
('assignment', models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, related_name='assignment_related_users', to='assignments.Assignment')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
2015-06-29 13:23:19 +02:00
],
options={
2016-01-09 18:49:38 +01:00
'default_permissions': (),
2015-06-29 13:23:19 +02:00
},
bases=(openslides.utils.models.RESTModelMixin, models.Model),
),
migrations.CreateModel(
name='AssignmentVote',
fields=[
2016-03-02 01:29:47 +01:00
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('weight', models.IntegerField(default=1, null=True)),
('value', models.CharField(max_length=255, null=True)),
('option', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='votes', to='assignments.AssignmentOption')),
2015-06-29 13:23:19 +02:00
],
options={
2016-01-09 18:49:38 +01:00
'default_permissions': (),
2015-06-29 13:23:19 +02:00
},
bases=(openslides.utils.models.RESTModelMixin, models.Model),
),
migrations.AddField(
model_name='assignmentoption',
name='poll',
2016-03-02 01:29:47 +01:00
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='options', to='assignments.AssignmentPoll'),
2015-06-29 13:23:19 +02:00
),
migrations.AddField(
model_name='assignment',
name='related_users',
2016-03-02 01:29:47 +01:00
field=models.ManyToManyField(through='assignments.AssignmentRelatedUser', to=settings.AUTH_USER_MODEL),
2015-06-29 13:23:19 +02:00
),
migrations.AddField(
model_name='assignment',
name='tags',
field=models.ManyToManyField(blank=True, to='core.Tag'),
2016-01-09 18:49:38 +01:00
),
migrations.AlterUniqueTogether(
name='assignmentrelateduser',
unique_together=set([('assignment', 'user')]),
2015-06-29 13:23:19 +02:00
),
]