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

116 lines
4.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
2016-01-09 18:49:38 +01:00
import uuid
2016-03-02 01:29:47 +01:00
import django.db.models.deletion
import jsonfield.fields
2016-01-09 18:49:38 +01:00
from django.conf import settings
from django.db import migrations, models
import openslides.utils.models
def add_default_projector(apps, schema_editor):
"""
2016-01-09 18:49:38 +01:00
Adds default projector and activates clock.
"""
# We get the model from the versioned app registry;
# if we directly import it, it will be the wrong version.
Projector = apps.get_model('core', 'Projector')
2016-01-09 18:49:38 +01:00
projector_config = {}
projector_config[uuid.uuid4().hex] = {
'name': 'core/clock',
'stable': True}
Projector.objects.create(config=projector_config)
class Migration(migrations.Migration):
2016-03-02 01:29:47 +01:00
initial = True
dependencies = [
2016-03-02 01:29:47 +01:00
('mediafiles', '0001_initial'),
2016-01-09 18:49:38 +01:00
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
2016-01-09 18:49:38 +01:00
migrations.CreateModel(
name='ChatMessage',
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
('message', models.TextField()),
('timestamp', models.DateTimeField(auto_now_add=True)),
2016-03-02 01:29:47 +01:00
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
2016-01-09 18:49:38 +01:00
],
options={
'default_permissions': (),
2016-03-02 01:29:47 +01:00
'permissions': (('can_use_chat', 'Can use the chat'),),
2016-01-09 18:49:38 +01:00
},
bases=(openslides.utils.models.RESTModelMixin, models.Model),
),
migrations.CreateModel(
name='ConfigStore',
fields=[
2016-03-02 01:29:47 +01:00
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('key', models.CharField(db_index=True, max_length=255, unique=True)),
2016-01-09 18:49:38 +01:00
('value', jsonfield.fields.JSONField()),
],
options={
'default_permissions': (),
2016-03-02 01:29:47 +01:00
'permissions': (('can_manage_config', 'Can manage configuration'),),
2016-01-09 18:49:38 +01:00
},
),
migrations.CreateModel(
name='CustomSlide',
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=256)),
('text', models.TextField(blank=True)),
('weight', models.IntegerField(default=0)),
2016-03-02 01:29:47 +01:00
('attachments', models.ManyToManyField(blank=True, to='mediafiles.Mediafile')),
],
options={
2016-01-09 18:49:38 +01:00
'default_permissions': (),
'ordering': ('weight', 'title'),
},
2015-06-29 12:08:15 +02:00
bases=(openslides.utils.models.RESTModelMixin, models.Model),
),
migrations.CreateModel(
name='Projector',
fields=[
2016-03-02 01:29:47 +01:00
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('config', jsonfield.fields.JSONField()),
2016-01-09 18:49:38 +01:00
('scale', models.IntegerField(default=0)),
('scroll', models.IntegerField(default=0)),
],
options={
2016-01-09 18:49:38 +01:00
'default_permissions': (),
2016-03-02 01:29:47 +01:00
'permissions': (
('can_see_projector', 'Can see the projector'),
('can_manage_projector', 'Can manage the projector'),
('can_see_frontpage', 'Can see the front page')),
},
2015-06-29 12:08:15 +02:00
bases=(openslides.utils.models.RESTModelMixin, models.Model),
),
migrations.CreateModel(
name='Tag',
fields=[
2016-03-02 01:29:47 +01:00
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255, unique=True)),
],
options={
2016-01-09 18:49:38 +01:00
'default_permissions': (),
2016-03-02 01:29:47 +01:00
'permissions': (('can_manage_tags', 'Can manage tags'),),
2016-01-09 18:49:38 +01:00
'ordering': ('name',),
2015-06-29 12:08:15 +02:00
},
bases=(openslides.utils.models.RESTModelMixin, models.Model),
),
migrations.RunPython(
2015-06-29 12:08:15 +02:00
code=add_default_projector,
reverse_code=None,
atomic=True,
),
]