OpenSlides/openslides/core/migrations/0001_initial.py
Norman Jäckel 132c6e81ec Forwarding JSON instead of Django model instances to autoupdate loop.
- Used raw SQL for createing default projector during inital migration.
- Removed default_password and hidden agenda items from autoupdate data for some users.
- Removed old get_collection_and_id_from_url() function.
2016-03-06 14:24:53 +01:00

110 lines
4.1 KiB
Python

# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-03-02 01:22
from __future__ import unicode_literals
import json
import uuid
import django.db.models.deletion
import jsonfield.fields
from django.conf import settings
from django.db import migrations, models
import openslides.utils.models
def add_default_projector_via_sql():
"""
Adds default projector and activates clock.
"""
projector_config = {}
projector_config[uuid.uuid4().hex] = {
'name': 'core/clock',
'stable': True}
return ["INSERT INTO core_projector (config, scale, scroll) VALUES ('{}', 0, 0);".format(json.dumps(projector_config))]
class Migration(migrations.Migration):
initial = True
dependencies = [
('mediafiles', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='ChatMessage',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('message', models.TextField()),
('timestamp', models.DateTimeField(auto_now_add=True)),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'default_permissions': (),
'permissions': (('can_use_chat', 'Can use the chat'),),
},
bases=(openslides.utils.models.RESTModelMixin, models.Model),
),
migrations.CreateModel(
name='ConfigStore',
fields=[
('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)),
('value', jsonfield.fields.JSONField()),
],
options={
'default_permissions': (),
'permissions': (('can_manage_config', 'Can manage configuration'),),
},
),
migrations.CreateModel(
name='CustomSlide',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=256)),
('text', models.TextField(blank=True)),
('weight', models.IntegerField(default=0)),
('attachments', models.ManyToManyField(blank=True, to='mediafiles.Mediafile')),
],
options={
'default_permissions': (),
'ordering': ('weight', 'title'),
},
bases=(openslides.utils.models.RESTModelMixin, models.Model),
),
migrations.CreateModel(
name='Projector',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('config', jsonfield.fields.JSONField()),
('scale', models.IntegerField(default=0)),
('scroll', models.IntegerField(default=0)),
],
options={
'default_permissions': (),
'permissions': (
('can_see_projector', 'Can see the projector'),
('can_manage_projector', 'Can manage the projector'),
('can_see_frontpage', 'Can see the front page')),
},
bases=(openslides.utils.models.RESTModelMixin, models.Model),
),
migrations.CreateModel(
name='Tag',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255, unique=True)),
],
options={
'default_permissions': (),
'permissions': (('can_manage_tags', 'Can manage tags'),),
'ordering': ('name',),
},
bases=(openslides.utils.models.RESTModelMixin, models.Model),
),
migrations.RunSQL(add_default_projector_via_sql()),
]