diff --git a/ietf/doc/migrations/0011_add_missing_docaliases.py b/ietf/doc/migrations/0011_add_missing_docaliases.py new file mode 100644 index 000000000..11ccc1662 --- /dev/null +++ b/ietf/doc/migrations/0011_add_missing_docaliases.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations +from django.db.models import F + +def reverse(apps, schema_editor): + pass + +def forward(apps, schema_editor): + Document = apps.get_model('doc','Document') + for doc in Document.objects.filter(type__in=['recording','liaison','liai-att']).exclude(docalias__name=F('name')): + doc.docalias_set.create(name=doc.name) + +class Migration(migrations.Migration): + + dependencies = [ + ('doc', '0010_auto_20150930_0251'), + ] + + operations = [ + migrations.RunPython(forward,reverse) + ] diff --git a/ietf/doc/models.py b/ietf/doc/models.py index ddc20b297..5f62c4c05 100644 --- a/ietf/doc/models.py +++ b/ietf/doc/models.py @@ -234,7 +234,7 @@ class DocumentInfo(models.Model): def meeting_related(self): answer = False - if self.type_id in ("agenda","minutes","bluesheets","slides"): + if self.type_id in ("agenda","minutes","bluesheets","slides","recording"): answer = (self.name.split("-")[1] == "interim" or (self if isinstance(self, Document) else self.doc).session_set.exists()) if self.type_id in ("slides",): diff --git a/ietf/doc/tests.py b/ietf/doc/tests.py index 12bd84888..c44278414 100644 --- a/ietf/doc/tests.py +++ b/ietf/doc/tests.py @@ -558,6 +558,9 @@ Man Expires September 22, 2015 [Page 3] "agenda-42-mars", "minutes-42-mars", "slides-42-mars-1", + # TODO: add + #"bluesheets-42-mars-1", + #"recording-42-mars-1-00", ]: doc = Document.objects.get(name=docname) # give it some history diff --git a/ietf/doc/views_doc.py b/ietf/doc/views_doc.py index 5b8eb4092..725e3dfc5 100644 --- a/ietf/doc/views_doc.py +++ b/ietf/doc/views_doc.py @@ -522,6 +522,8 @@ def document_main(request, name, rev=None): ), context_instance=RequestContext(request)) + # TODO : Add "recording", and "bluesheets" here when those documents are appropriately + # created and content is made available on disk if doc.type_id in ("slides", "agenda", "minutes"): can_manage_material = can_manage_materials(request.user, doc.group) presentations = None diff --git a/ietf/liaisons/forms.py b/ietf/liaisons/forms.py index 9c09414ff..646864382 100644 --- a/ietf/liaisons/forms.py +++ b/ietf/liaisons/forms.py @@ -346,7 +346,7 @@ class LiaisonModelForm(BetterModelForm): extension = '' written += 1 name = self.instance.name() + ("-attachment-%s" % written) - attach, _ = Document.objects.get_or_create( + attach, created = Document.objects.get_or_create( name = name, defaults=dict( title = attachment_title, @@ -354,6 +354,8 @@ class LiaisonModelForm(BetterModelForm): external_url = name + extension, # strictly speaking not necessary, but just for the time being ... ) ) + if created: + attach.docalias_set.create(name=attach.name) LiaisonStatementAttachment.objects.create(statement=self.instance,document=attach) attach_file = open(os.path.join(settings.LIAISON_ATTACH_PATH, attach.name + extension), 'w') attach_file.write(attached_file.read()) diff --git a/ietf/secr/proceedings/proc_utils.py b/ietf/secr/proceedings/proc_utils.py index f5722cc5e..00c5b256e 100644 --- a/ietf/secr/proceedings/proc_utils.py +++ b/ietf/secr/proceedings/proc_utils.py @@ -77,6 +77,8 @@ def create_recording(session,meeting,group,url): rev='00', type_id='recording') doc.set_state(State.objects.get(type='recording', slug='active')) + + doc.docalias_set.create(name=name) # create DocEvent NewRevisionDocEvent.objects.create(type='new_revision', diff --git a/ietf/templates/meeting/session_details.html b/ietf/templates/meeting/session_details.html index 08925df22..b18065991 100644 --- a/ietf/templates/meeting/session_details.html +++ b/ietf/templates/meeting/session_details.html @@ -16,12 +16,14 @@
- {{pres.document.title}} ({{ pres.document.name }}-{{ pres.rev }}) - - | -
+ {{pres.document.title}} ({{ pres.document.name }}-{{ pres.rev }}) + + | +