|
| 1 | +# Copyright The IETF Trust 2020, All Rights Reserved |
| 2 | +# -*- coding: utf-8 -*- |
| 3 | +# Generated by Django 1.11.29 on 2020-03-18 16:18 |
| 4 | +from __future__ import unicode_literals |
| 5 | + |
| 6 | +from django.db import migrations |
| 7 | + |
| 8 | + |
| 9 | +def cancel_sessions(apps, schema_editor): |
| 10 | + Session = apps.get_model('meeting', 'Session') |
| 11 | + SchedulingEvent = apps.get_model('meeting', 'SchedulingEvent') |
| 12 | + SessionStatusName = apps.get_model('name', 'SessionStatusName') |
| 13 | + Person = apps.get_model('person', 'Person') |
| 14 | + excludes = ['txauth','dispatch','add','raw','masque','wpack','drip','gendispatch','privacypass', 'ript', 'secdispatch', 'webtrans'] |
| 15 | + canceled = SessionStatusName.objects.get(slug='canceled') |
| 16 | + person = Person.objects.get(name='Ryan Cross') |
| 17 | + sessions = Session.objects.filter(meeting__number=107,group__type__in=['wg','rg','ag']).exclude(group__acronym__in=excludes) |
| 18 | + for session in sessions: |
| 19 | + SchedulingEvent.objects.create( |
| 20 | + session = session, |
| 21 | + status = canceled, |
| 22 | + by = person) |
| 23 | + |
| 24 | + |
| 25 | +def reverse(apps, schema_editor): |
| 26 | + SchedulingEvent = apps.get_model('meeting', 'SchedulingEvent') |
| 27 | + Person = apps.get_model('person', 'Person') |
| 28 | + person = Person.objects.get(name='Ryan Cross') |
| 29 | + SchedulingEvent.objects.filter(meeting__number=107, by=person).delete() |
| 30 | + |
| 31 | + |
| 32 | +class Migration(migrations.Migration): |
| 33 | + |
| 34 | + dependencies = [ |
| 35 | + ('meeting', '0025_rename_type_session_to_regular'), |
| 36 | + ] |
| 37 | + |
| 38 | + operations = [ |
| 39 | + migrations.RunPython(cancel_sessions, reverse), |
| 40 | + ] |
0 commit comments