Still clunky but far enough along for sprinters to play with and comment on

- Legacy-Id: 9720
This commit is contained in:
Robert Sparks 2015-07-15 02:13:48 +00:00
parent 61474a4988
commit 609f368ce1
7 changed files with 90 additions and 12 deletions

31
hack_pres.py Executable file
View file

@ -0,0 +1,31 @@
#!/usr/bin/python
import os, sys
import django
#basedir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
#sys.path.insert(0, basedir)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ietf.settings")
django.setup()
from django.db.utils import IntegrityError
from ietf.meeting.views import session_draft_list
from ietf.meeting.models import Meeting
from ietf.doc.models import Document
m93 = Meeting.objects.get(number=93)
for acronym in set(m93.agenda.scheduledsession_set.values_list('session__group__acronym',flat=True)):
for namerev in session_draft_list(93,acronym):
name=namerev[:-3]
rev = namerev[-2:]
doc = Document.objects.filter(docalias__name=name).first()
if not doc:
print "Can't find anything named",name
else:
for session in m93.session_set.filter(group__acronym=acronym):
try:
session.sessionpresentation_set.get_or_create(document=doc,rev=rev)
except IntegrityError:
print "No luck on ",acronym,"->",name,rev

View file

@ -299,6 +299,8 @@ def document_main(request, name, rev=None):
status_changes = [ rel.document for rel in status_change_docs if rel.document.get_state_slug() in ('appr-sent','appr-pend')]
proposed_status_changes = [ rel.document for rel in status_change_docs if rel.document.get_state_slug() in ('needshep','adrev','iesgeval','defer','appr-pr')]
presentations = doc.future_presentations()
# remaining actions
actions = []
@ -361,6 +363,7 @@ def document_main(request, name, rev=None):
table_rows['stream'] += 1 if consensus else 0
table_rows['stream'] += 1 if shepherd_writeup or can_edit_shepherd_writeup else 0
table_rows['stream'] += 1 if published and started_iesg_process and published.time < started_iesg_process.time else 0
table_rows['stream'] += 1 if presentations or can_edit_stream_info else 0
table_rows['iesg'] += 1 if iesg_state and (doc.note or can_edit) else 0
@ -422,6 +425,7 @@ def document_main(request, name, rev=None):
search_archive=search_archive,
actions=actions,
tracking_document=tracking_document,
presentations=presentations,
),
context_instance=RequestContext(request))
@ -540,13 +544,15 @@ def document_main(request, name, rev=None):
if doc.type_id in ("slides", "agenda", "minutes"):
can_manage_material = can_manage_materials(request.user, doc.group)
presentations = None
if doc.type_id=='slides' and doc.get_state_slug('slides')=='active' :
presentations = doc.future_presentations()
#presentations = None
#if doc.type_id=='slides' and doc.get_state_slug('slides')=='active' :
# presentations = doc.future_presentations()
presentations = doc.future_presentations()
if doc.meeting_related():
# disallow editing meeting-related stuff through this
# interface for the time being
can_manage_material = False
## disallow editing meeting-related stuff through this
## interface for the time being
# Now try allowing it
# can_manage_material = False
basename = doc.canonical_name() # meeting materials are unversioned at the moment
if doc.external_url:
# we need to remove the extension for the globbing below to work

View file

@ -250,11 +250,15 @@ def get_upcoming_manageable_sessions(user, doc, acronym=None, date=None, seq=Non
def edit_material_presentations(request, name, acronym=None, date=None, seq=None, week_day=None):
doc = get_object_or_404(Document, name=name)
if not (doc.type_id=='slides' and doc.get_state('slides').slug=='active'):
raise Http404
# For now, allow any document type, in any state to be put on an agenda.
# if not (doc.type_id=='slides' and doc.get_state('slides').slug=='active'):
# raise Http404
group = doc.group
if not (group.features.has_materials and can_manage_materials(request.user,group)):
#if not (group.features.has_materials and can_manage_materials(request.user,group)):
if not can_manage_materials(request.user,group):
raise Http404
sorted_sessions = get_upcoming_manageable_sessions(request.user, doc, acronym, date, seq, week_day)
@ -301,11 +305,16 @@ def edit_material_presentations(request, name, acronym=None, date=None, seq=None
def material_presentations(request, name, acronym=None, date=None, seq=None, week_day=None):
doc = get_object_or_404(Document, name=name)
if not (doc.type_id=='slides' and doc.get_state('slides').slug=='active'):
raise Http404
# For now, allow any document type, in any state to be put on an agenda.
#if not (doc.type_id=='slides' and doc.get_state('slides').slug=='active'):
# raise Http404
group = doc.group
if not (group.features.has_materials and can_manage_materials(request.user,group)):
#if not (group.features.has_materials and can_manage_materials(request.user,group)):
if not can_manage_materials(request.user,group):
raise Http404
sorted_sessions = get_upcoming_manageable_sessions(request.user, doc, acronym, date, seq, week_day)

View file

@ -895,6 +895,9 @@ class Session(models.Model):
def slides(self):
return list(self.materials.filter(type='slides').exclude(states__type='slides',states__slug='deleted').order_by('order'))
def drafts(self):
return list(self.materials.filter(type='draft'))
def __unicode__(self):
if self.meeting.type_id == "interim":
return self.meeting.number

View file

@ -196,6 +196,25 @@
</tr>
{% endif %}
{% if presentations or can_edit_stream_info %}
<tr>
<th>On Agenda</th>
<td class="edit">
{% if not snapshot and can_edit_stream_info %}
{% doc_edit_button "material_presentations" name=doc.name %}
{% endif %}
</td>
<td>
{% if presentations %}
{% for pres in presentations %}{{ pres.session.short_name }} at {{ pres.session.meeting }} {% if pres.rev != doc.rev %}(version -{{ pres.rev }}){% endif %}{% if not forloop.last %}, {% endif %}{% endfor %}
{% else %}
None
{% endif %}
</td>
</tr>
{% endif %}
<tr>
<th>Document shepherd</th>
<td class="edit">

View file

@ -48,6 +48,15 @@
{% endfor %}
{% endwith %}
</td>
<td>
{% with session.drafts as drafts %}
{% for draft in drafts %}
<a href="{% url "doc_view" name=draft.canonical_name %}">{{ draft.canonical_name }}</a><br>
{% empty %}
<span class="label label-warning">No drafts</span>
{% endfor %}
{% endwith %}
</td>
{% endif %}
</tr>

View file

@ -64,6 +64,7 @@
<th>Agenda</th>
<th>Minutes</th>
<th>Slides</th>
<th>Drafts</th>
</tr>
</thead>