Skip to content

Commit b8f84dc

Browse files
committed
Merged in [9375] from rjsparks@nostrum.com:
Put old style slides directly into archived. Migrate IETF92 materials to match. - Legacy-Id: 9432 Note: SVN reference [9375] has been migrated to Git commit d460350
2 parents 443e9bf + d460350 commit b8f84dc

2 files changed

Lines changed: 41 additions & 3 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
4+
from django.db import migrations
5+
6+
def set_state(doc, state):
7+
already_set = doc.states.filter(type=state.type)
8+
others = [s for s in already_set if s != state]
9+
if others:
10+
doc.states.remove(*others)
11+
if state not in already_set:
12+
doc.states.add(state)
13+
doc.state_cache = None
14+
15+
def forward_archive_slides(apps,schema_editor):
16+
Document = apps.get_model('doc', 'Document')
17+
State = apps.get_model('doc','State')
18+
archived = State.objects.get(type__slug='slides',slug='archived')
19+
for doc in Document.objects.filter(name__startswith='slides-92-',states__type__slug='slides',states__slug='active'):
20+
set_state(doc,archived)
21+
22+
def reverse_archive_slides(apps,schema_editor):
23+
Document = apps.get_model('doc', 'Document')
24+
State = apps.get_model('doc','State')
25+
active = State.objects.get(type__slug='slides',slug='active')
26+
for doc in Document.objects.filter(name__startswith='slides-92-',states__type__slug='slides',states__slug='archived'):
27+
set_state(doc,active)
28+
29+
class Migration(migrations.Migration):
30+
31+
dependencies = [
32+
('doc', '0003_auto_20150326_0728'),
33+
]
34+
35+
operations = [
36+
migrations.RunPython(forward_archive_slides,reverse_archive_slides),
37+
]

ietf/secr/proceedings/views.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -912,9 +912,10 @@ def redirection_back(meeting, group):
912912
handle_upload_file(file,disk_filename,meeting,material_type.slug)
913913

914914
# set Doc state
915-
state = State.objects.get(type=doc.type,slug='active')
916-
doc.set_state(state)
917-
doc.set_state(State.objects.get(type='reuse_policy',slug='single'))
915+
state = State.objects.get(type=doc.type,slug='active' if doc.type.slug!='slides' else 'archived')
916+
if doc.type.slug=='slides':
917+
doc.set_state(state)
918+
doc.set_state(State.objects.get(type='reuse_policy',slug='single'))
918919

919920
# create session relationship, per Henrik we should associate documents to all sessions
920921
# for the current meeting (until tools support different materials for diff sessions)

0 commit comments

Comments
 (0)