Put old style slides directly into archived. Migrate IETF92 materials to match. Commit ready for merge.
- Legacy-Id: 9375
This commit is contained in:
parent
284f78e137
commit
d46035003e
37
ietf/doc/migrations/0004_auto_20150403_1235.py
Normal file
37
ietf/doc/migrations/0004_auto_20150403_1235.py
Normal file
|
@ -0,0 +1,37 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
def set_state(doc, state):
|
||||
already_set = doc.states.filter(type=state.type)
|
||||
others = [s for s in already_set if s != state]
|
||||
if others:
|
||||
doc.states.remove(*others)
|
||||
if state not in already_set:
|
||||
doc.states.add(state)
|
||||
doc.state_cache = None
|
||||
|
||||
def forward_archive_slides(apps,schema_editor):
|
||||
Document = apps.get_model('doc', 'Document')
|
||||
State = apps.get_model('doc','State')
|
||||
archived = State.objects.get(type__slug='slides',slug='archived')
|
||||
for doc in Document.objects.filter(name__startswith='slides-92-',states__type__slug='slides',states__slug='active'):
|
||||
set_state(doc,archived)
|
||||
|
||||
def reverse_archive_slides(apps,schema_editor):
|
||||
Document = apps.get_model('doc', 'Document')
|
||||
State = apps.get_model('doc','State')
|
||||
active = State.objects.get(type__slug='slides',slug='active')
|
||||
for doc in Document.objects.filter(name__startswith='slides-92-',states__type__slug='slides',states__slug='archived'):
|
||||
set_state(doc,active)
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('doc', '0003_auto_20150326_0728'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(forward_archive_slides,reverse_archive_slides),
|
||||
]
|
|
@ -912,9 +912,10 @@ def upload_unified(request, meeting_num, acronym=None, session_id=None):
|
|||
handle_upload_file(file,disk_filename,meeting,material_type.slug)
|
||||
|
||||
# set Doc state
|
||||
state = State.objects.get(type=doc.type,slug='active')
|
||||
doc.set_state(state)
|
||||
doc.set_state(State.objects.get(type='reuse_policy',slug='single'))
|
||||
state = State.objects.get(type=doc.type,slug='active' if doc.type.slug!='slides' else 'archived')
|
||||
if doc.type.slug=='slides':
|
||||
doc.set_state(state)
|
||||
doc.set_state(State.objects.get(type='reuse_policy',slug='single'))
|
||||
|
||||
# create session relationship, per Henrik we should associate documents to all sessions
|
||||
# for the current meeting (until tools support different materials for diff sessions)
|
||||
|
|
Loading…
Reference in a new issue