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):
|
|
|
|
|
|
|
|
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-01-09 18:49:38 +01:00
|
|
|
('id', models.AutoField(auto_created=True, serialize=False, primary_key=True, verbose_name='ID')),
|
|
|
|
('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={
|
|
|
|
'permissions': (
|
2016-01-09 18:49:38 +01:00
|
|
|
('can_see', 'Can see elections'), ('can_nominate_other', 'Can nominate another participant'),
|
|
|
|
('can_nominate_self', 'Can nominate oneself'), ('can_manage', 'Can manage elections')),
|
|
|
|
'verbose_name': 'Election',
|
2015-06-29 13:23:19 +02:00
|
|
|
'ordering': ('title',),
|
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='AssignmentOption',
|
|
|
|
fields=[
|
2016-01-09 18:49:38 +01:00
|
|
|
('id', models.AutoField(auto_created=True, serialize=False, primary_key=True, verbose_name='ID')),
|
2015-06-29 13:23:19 +02:00
|
|
|
('candidate', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
|
|
|
|
],
|
|
|
|
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-01-09 18:49:38 +01:00
|
|
|
('id', models.AutoField(auto_created=True, serialize=False, primary_key=True, verbose_name='ID')),
|
|
|
|
('votesvalid', openslides.utils.models.MinMaxIntegerField(null=True, blank=True)),
|
|
|
|
('votesinvalid', openslides.utils.models.MinMaxIntegerField(null=True, blank=True)),
|
|
|
|
('votescast', openslides.utils.models.MinMaxIntegerField(null=True, blank=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)),
|
2015-06-29 13:23:19 +02:00
|
|
|
('assignment', models.ForeignKey(related_name='polls', to='assignments.Assignment')),
|
|
|
|
],
|
|
|
|
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-01-09 18:49:38 +01:00
|
|
|
('id', models.AutoField(auto_created=True, serialize=False, primary_key=True, verbose_name='ID')),
|
|
|
|
('elected', models.BooleanField(default=False)),
|
2015-06-29 13:23:19 +02:00
|
|
|
('assignment', models.ForeignKey(related_name='assignment_related_users', to='assignments.Assignment')),
|
|
|
|
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
|
|
|
|
],
|
|
|
|
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-01-09 18:49:38 +01:00
|
|
|
('id', models.AutoField(auto_created=True, serialize=False, primary_key=True, verbose_name='ID')),
|
2015-06-29 13:23:19 +02:00
|
|
|
('weight', models.IntegerField(null=True, default=1)),
|
|
|
|
('value', models.CharField(null=True, max_length=255)),
|
2016-01-09 18:49:38 +01:00
|
|
|
('option', models.ForeignKey(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-01-09 18:49:38 +01:00
|
|
|
field=models.ForeignKey(related_name='options', to='assignments.AssignmentPoll'),
|
2015-06-29 13:23:19 +02:00
|
|
|
),
|
|
|
|
migrations.AddField(
|
|
|
|
model_name='assignment',
|
|
|
|
name='related_users',
|
2016-01-09 18:49:38 +01:00
|
|
|
field=models.ManyToManyField(to=settings.AUTH_USER_MODEL, through='assignments.AssignmentRelatedUser'),
|
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
|
|
|
),
|
|
|
|
]
|