|
| 1 | +# Copyright The IETF Trust 2019, All Rights Reserved |
| 2 | +# -*- coding: utf-8 -*- |
| 3 | +# Generated by Django 1.11.16 on 2019-01-09 09:02 |
| 4 | +from __future__ import unicode_literals |
| 5 | + |
| 6 | + |
| 7 | +from django.db import migrations |
| 8 | + |
| 9 | +import debug # pyflakes:ignore |
| 10 | + |
| 11 | +# |
| 12 | + |
| 13 | + |
| 14 | +group_type_features = { |
| 15 | + 'adhoc': { |
| 16 | + 'grouptypename': { |
| 17 | + "slug": 'adhoc', |
| 18 | + "desc": 'Ad Hoc schedulable Group Type, for instance HotRfc', |
| 19 | + "name": "Ad Hoc", |
| 20 | + "order": 0, |
| 21 | + "used": True, |
| 22 | + "verbose_name": "Ad Hoc Group Type", |
| 23 | + }, |
| 24 | + 'groupfeatures': { |
| 25 | + 'about_page': 'ietf.group.views.group_about', |
| 26 | + 'acts_like_wg': False, |
| 27 | + 'admin_roles': '["chair"]', |
| 28 | + 'agenda_type_id': 'ietf', |
| 29 | + 'create_wiki': True, |
| 30 | + 'custom_group_roles': False, |
| 31 | + 'customize_workflow': False, |
| 32 | + 'default_tab': 'ietf.group.views.group_about', |
| 33 | + 'docman_roles': '["chair"]', |
| 34 | + 'groupman_roles': '["chair","delegate"]', |
| 35 | + 'has_chartering_process': False, |
| 36 | + 'has_default_jabber': True, |
| 37 | + 'has_documents': False, |
| 38 | + 'has_meetings': True, |
| 39 | + 'has_milestones': False, |
| 40 | + 'has_nonsession_materials': False, |
| 41 | + 'has_reviews': False, |
| 42 | + 'has_session_materials': True, |
| 43 | + 'is_schedulable': True, |
| 44 | + 'material_types': '["slides"]', |
| 45 | + 'matman_roles': '["chair","delegate"]', |
| 46 | + 'req_subm_approval': True, |
| 47 | + 'role_order': '["chair","delegate"]', |
| 48 | + 'show_on_agenda': True, |
| 49 | + }, |
| 50 | + }, |
| 51 | + 'iesg': { |
| 52 | + 'grouptypename': { |
| 53 | + "slug": 'iesg', |
| 54 | + "desc": '', |
| 55 | + "name": "IESG", |
| 56 | + "order": 0, |
| 57 | + "used": True, |
| 58 | + "verbose_name": "Internet Engineering Steering Group" |
| 59 | + }, |
| 60 | + 'groupfeatures': { |
| 61 | + 'about_page': 'ietf.group.views.group_about', |
| 62 | + 'acts_like_wg': False, |
| 63 | + 'admin_roles': '["chair"]', |
| 64 | + 'agenda_type_id': None, |
| 65 | + 'create_wiki': False, |
| 66 | + 'custom_group_roles': True, |
| 67 | + 'customize_workflow': False, |
| 68 | + 'default_tab': 'ietf.group.views.group_about', |
| 69 | + 'docman_roles': '["chair"]', |
| 70 | + 'groupman_roles': '["chair","delegate"]', |
| 71 | + 'has_chartering_process': False, |
| 72 | + 'has_default_jabber': False, |
| 73 | + 'has_documents': False, |
| 74 | + 'has_meetings': False, |
| 75 | + 'has_milestones': False, |
| 76 | + 'has_nonsession_materials': False, |
| 77 | + 'has_reviews': False, |
| 78 | + 'has_session_materials': False, |
| 79 | + 'is_schedulable': False, |
| 80 | + 'material_types': '[]', |
| 81 | + 'matman_roles': '["chair","delegate"]', |
| 82 | + 'req_subm_approval': True, |
| 83 | + 'role_order': '["chair","secr"]', |
| 84 | + 'show_on_agenda': False |
| 85 | + }, |
| 86 | + }, |
| 87 | + 'ise': { |
| 88 | + 'grouptypename': { |
| 89 | + "slug": 'ise', |
| 90 | + "desc": '', |
| 91 | + "name": "ISE", |
| 92 | + "order": 0, |
| 93 | + "used": True, |
| 94 | + "verbose_name": "Independent Stream Editor", |
| 95 | + }, |
| 96 | + 'groupfeatures': { |
| 97 | + 'about_page': 'ietf.group.views.group_about', |
| 98 | + 'acts_like_wg': False, |
| 99 | + 'admin_roles': '["chair","lead"]', |
| 100 | + 'agenda_type_id': None, |
| 101 | + 'create_wiki': False, |
| 102 | + 'custom_group_roles': True, |
| 103 | + 'customize_workflow': False, |
| 104 | + 'default_tab': 'ietf.group.views.group_about', |
| 105 | + 'docman_roles': '["chair"]', |
| 106 | + 'groupman_roles': '["chair","delegate"]', |
| 107 | + 'has_chartering_process': False, |
| 108 | + 'has_default_jabber': False, |
| 109 | + 'has_documents': False, |
| 110 | + 'has_meetings': False, |
| 111 | + 'has_milestones': False, |
| 112 | + 'has_nonsession_materials': False, |
| 113 | + 'has_reviews': False, |
| 114 | + 'has_session_materials': False, |
| 115 | + 'is_schedulable': False, |
| 116 | + 'material_types': '[]', |
| 117 | + 'matman_roles': '["chair","delegate"]', |
| 118 | + 'req_subm_approval': True, |
| 119 | + 'role_order': '["chair"]', |
| 120 | + 'show_on_agenda': False |
| 121 | + }, |
| 122 | + }, |
| 123 | +} |
| 124 | + |
| 125 | +def forward(apps, schema_editor): |
| 126 | + GroupTypeName = apps.get_model('name', 'GroupTypeName') |
| 127 | + GroupFeatures = apps.get_model('group', 'GroupFeatures') |
| 128 | + for slug in group_type_features: |
| 129 | + typename = group_type_features[slug]['grouptypename'] |
| 130 | + gt, _ = GroupTypeName.objects.get_or_create(slug=slug) |
| 131 | + for k,v in typename.items(): |
| 132 | + setattr(gt, k, v) |
| 133 | + gt.save() |
| 134 | + # |
| 135 | + features = group_type_features[slug]['groupfeatures'] |
| 136 | + gf, _ = GroupFeatures.objects.get_or_create(type_id=slug) |
| 137 | + for k,v in features.items(): |
| 138 | + setattr(gf, k, v) |
| 139 | + gf.save() |
| 140 | + |
| 141 | + |
| 142 | +# This migration does not remove or change any previous fields, and executes |
| 143 | +# swirftly, so we permit it to be interleaved with schema migrations |
| 144 | +forward.interleavable = True |
| 145 | + |
| 146 | +def reverse(apps, schema_editor): |
| 147 | + pass |
| 148 | + |
| 149 | +class Migration(migrations.Migration): |
| 150 | + |
| 151 | + dependencies = [ |
| 152 | + ('group', '0010_remove_groupfeatures_has_dependencies') |
| 153 | + ] |
| 154 | + |
| 155 | + operations = [ |
| 156 | + migrations.RunPython(forward, reverse), |
| 157 | + ] |
0 commit comments