Addresses issues uncovered by the test-crawler. Adds missing DocAlias records for several document types. Creates DocAlias objects when createing Document objects for those document types. Identifies places in code to touch when we are ready to expose the bluesheets and recording document types at /doc/. (The data rows and the content store need work before doing so).
- Legacy-Id: 10731
This commit is contained in:
parent
6eaff2aaf0
commit
757397330c
23
ietf/doc/migrations/0011_add_missing_docaliases.py
Normal file
23
ietf/doc/migrations/0011_add_missing_docaliases.py
Normal file
|
@ -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)
|
||||
]
|
|
@ -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",):
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -76,6 +76,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',
|
||||
|
|
|
@ -16,12 +16,14 @@
|
|||
|
||||
<table class="table table-condensed table-striped">
|
||||
{% for pres in session.filtered_sessionpresentation_set %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{% url 'doc_view' name=pres.document.name rev=pres.rev%}">{{pres.document.title}} ({{ pres.document.name }}-{{ pres.rev }})
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% if pres.document.type_id != 'bluesheets' and pres.document.type_id != 'recording' %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{% url 'doc_view' name=pres.document.name rev=pres.rev%}">{{pres.document.title}} ({{ pres.document.name }}-{{ pres.rev }})
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endif %}
|
||||
|
|
|
@ -351,5 +351,8 @@ def make_test_data():
|
|||
other_doc_factory('agenda','agenda-42-mars')
|
||||
other_doc_factory('minutes','minutes-42-mars')
|
||||
other_doc_factory('slides','slides-42-mars-1')
|
||||
# TODO: add
|
||||
#other_doc_factory('bluesheets','bluesheets-42-mars-1')
|
||||
#other_doc_factory('recording','recording-42-mars-1-00')
|
||||
|
||||
return draft
|
||||
|
|
Loading…
Reference in a new issue