OpenSlides/openslides/agenda/migrations/0005_auto_20180815_1109.py

58 lines
1.8 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-08-15 09:09
from __future__ import unicode_literals
from django.contrib.auth.models import Permission
from django.db import migrations, models
from openslides.utils.migrations import (
add_permission_to_groups_based_on_existing_permission,
)
def delete_old_can_see_hidden_permission(apps, schema_editor):
2019-01-06 16:22:33 +01:00
perm = Permission.objects.filter(codename="can_see_hidden_items")
if len(perm):
perm = perm.delete()
class Migration(migrations.Migration):
2019-01-06 16:22:33 +01:00
dependencies = [("agenda", "0004_speaker_marked")]
operations = [
migrations.AlterModelOptions(
2019-01-06 16:22:33 +01:00
name="item",
options={
2019-01-06 16:22:33 +01:00
"default_permissions": (),
"permissions": (
("can_see", "Can see agenda"),
("can_manage", "Can manage agenda"),
("can_manage_list_of_speakers", "Can manage list of speakers"),
(
"can_see_internal_items",
"Can see internal items and time scheduling of agenda",
),
),
},
),
migrations.AlterField(
2019-01-06 16:22:33 +01:00
model_name="item",
name="type",
field=models.IntegerField(
2019-01-06 16:22:33 +01:00
choices=[(1, "Agenda item"), (2, "Internal item"), (3, "Hidden item")],
default=3,
),
),
2019-01-06 16:22:33 +01:00
migrations.RunPython(
add_permission_to_groups_based_on_existing_permission(
"can_see_hidden_items",
"item",
"agenda",
"can_see_internal_items",
"Can see internal items and time scheduling of agenda",
)
),
migrations.RunPython(delete_old_can_see_hidden_permission),
]