Port a good deal of the agenda views in iesg.views
- Legacy-Id: 3128
This commit is contained in:
parent
9f03d0ecd6
commit
c04f107177
ietf
redesign
|
@ -67,7 +67,7 @@ def render_ballot_icon(context, doc):
|
|||
return ""
|
||||
if str(doc.cur_state) not in BALLOT_ACTIVE_STATES:
|
||||
return ""
|
||||
if doc.rfc_flag:
|
||||
if doc.rfc_flag and not settings.USE_DB_REDESIGN_PROXY_CLASSES:
|
||||
name = doc.document().filename()
|
||||
else:
|
||||
name = doc.document().filename
|
||||
|
|
|
@ -107,6 +107,7 @@ class WGAction(models.Model):
|
|||
(22, "WG Rechartering::Under evaluation for IETF Review"),
|
||||
(23, "WG Rechartering::Proposed for Approval")
|
||||
)
|
||||
# note that with the new schema, Acronym is monkey-patched and is really Group
|
||||
group_acronym = models.ForeignKey(Acronym, db_column='group_acronym_id', primary_key=True, unique=True)
|
||||
note = models.TextField(blank=True,null=True)
|
||||
status_date = models.DateField()
|
||||
|
|
|
@ -106,6 +106,61 @@ def wgdocs(request,cat):
|
|||
queryset_list_doc.append(sub_item2)
|
||||
return render_to_response( 'iesg/ietf_doc.html', {'object_list': queryset_list, 'object_list_doc':queryset_list_doc, 'is_recent':is_recent}, context_instance=RequestContext(request) )
|
||||
|
||||
def wgdocsREDESIGN(request,cat):
|
||||
is_recent = 0
|
||||
proto_actions = []
|
||||
doc_actions = []
|
||||
threshold = date_threshold()
|
||||
|
||||
proto_levels = ["bcp", "ds", "ps", "std"]
|
||||
doc_levels = ["exp", "inf"]
|
||||
|
||||
if cat == 'new':
|
||||
is_recent = 1
|
||||
|
||||
drafts = InternetDraft.objects.filter(event__type="iesg_approved", event__time__gte=threshold, intended_std_level__in=proto_levels + doc_levels).exclude(tags__slug="via-rfc").distinct()
|
||||
for d in drafts:
|
||||
if d.b_approve_date and d.b_approve_date >= threshold:
|
||||
if d.intended_std_level_id in proto_levels:
|
||||
proto_actions.append(d)
|
||||
elif d.intended_std_level_id in doc_levels:
|
||||
doc_actions.append(d)
|
||||
|
||||
elif cat == 'prev':
|
||||
# proto
|
||||
start_date = datetime.date(1997, 12, 1)
|
||||
|
||||
drafts = InternetDraft.objects.filter(event__type="iesg_approved", event__time__lt=threshold, event__time__gte=start_date, intended_std_level__in=proto_levels).exclude(tags__slug="via-rfc").distinct()
|
||||
|
||||
for d in drafts:
|
||||
if d.b_approve_date and start_date <= d.b_approve_date < threshold:
|
||||
proto_actions.append(d)
|
||||
|
||||
# doc
|
||||
start_date = datetime.date(1998, 10, 15)
|
||||
|
||||
drafts = InternetDraft.objects.filter(event__type="iesg_approved", event__time__lt=threshold, event__time__gte=start_date, intended_std_level__in=doc_levels).exclude(tags__slug="via-rfc").distinct()
|
||||
|
||||
for d in drafts:
|
||||
if d.b_approve_date and start_date <= d.b_approve_date < threshold:
|
||||
doc_actions.append(d)
|
||||
else:
|
||||
raise Http404
|
||||
|
||||
proto_actions.sort(key=lambda d: d.b_approve_date, reverse=True)
|
||||
doc_actions.sort(key=lambda d: d.b_approve_date, reverse=True)
|
||||
|
||||
return render_to_response('iesg/ietf_doc.html',
|
||||
dict(object_list=proto_actions,
|
||||
object_list_doc=doc_actions,
|
||||
is_recent=is_recent,
|
||||
title_prefix="Recent" if is_recent else "Previous"),
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
|
||||
wgdocs = wgdocsREDESIGN
|
||||
|
||||
|
||||
def get_doc_section(id):
|
||||
states = [16,17,18,19,20,21]
|
||||
if id.document().intended_status.intended_status_id in [1,2,6,7]:
|
||||
|
@ -130,14 +185,63 @@ def get_doc_section(id):
|
|||
s = s + "1"
|
||||
return s
|
||||
|
||||
def agenda_docs(date, next_agenda):
|
||||
if next_agenda:
|
||||
matches = IDInternal.objects.filter(telechat_date=date, primary_flag=1, agenda=1)
|
||||
def get_doc_sectionREDESIGN(id):
|
||||
states = [16,17,18,19,20,21]
|
||||
if id.intended_std_level_id in ["bcp", "ds", "ps", "std"]:
|
||||
s = "2"
|
||||
else:
|
||||
matches = IDInternal.objects.filter(telechat_date=date, primary_flag=1)
|
||||
idmatches = matches.filter(rfc_flag=0).order_by('ballot')
|
||||
rfcmatches = matches.filter(rfc_flag=1).order_by('ballot')
|
||||
res = {}
|
||||
s = "3"
|
||||
|
||||
g = id.document().group_acronym()
|
||||
if g and str(g) != 'none':
|
||||
s = s + "1"
|
||||
elif (s == "3") and id.via_rfc_editor:
|
||||
s = s + "3"
|
||||
else:
|
||||
s = s + "2"
|
||||
if not id.rfc_flag and id.cur_state.document_state_id not in states:
|
||||
s = s + "3"
|
||||
elif id.returning_item:
|
||||
s = s + "2"
|
||||
else:
|
||||
s = s + "1"
|
||||
return s
|
||||
|
||||
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
|
||||
get_doc_section = get_doc_sectionREDESIGN
|
||||
|
||||
def agenda_docs(date, next_agenda):
|
||||
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
|
||||
from doc.models import TelechatEvent
|
||||
|
||||
matches = IDInternal.objects.filter(event__telechatevent__telechat_date=date)
|
||||
|
||||
idmatches = []
|
||||
rfcmatches = []
|
||||
|
||||
for m in matches:
|
||||
if m.latest_event(TelechatEvent, type="scheduled_for_telechat").telechat_date != date:
|
||||
continue
|
||||
|
||||
if next_agenda and not m.agenda:
|
||||
continue
|
||||
|
||||
if m.docalias_set.filter(name__startswith="rfc"):
|
||||
rfcmatches.append(m)
|
||||
else:
|
||||
idmatches.append(m)
|
||||
|
||||
idmatches.sort(key=lambda d: d.start_date or datetime.date.min)
|
||||
rfcmatches.sort(key=lambda d: d.start_date or datetime.date.min)
|
||||
else:
|
||||
if next_agenda:
|
||||
matches = IDInternal.objects.filter(telechat_date=date, primary_flag=1, agenda=1)
|
||||
else:
|
||||
matches = IDInternal.objects.filter(telechat_date=date, primary_flag=1)
|
||||
idmatches = matches.filter(rfc_flag=0).order_by('ballot')
|
||||
rfcmatches = matches.filter(rfc_flag=1).order_by('ballot')
|
||||
|
||||
res = dict(("s%s%s%s" % (i, j, k), []) for i in range(2, 5) for j in range (1, 4) for k in range(1, 4))
|
||||
for id in list(idmatches)+list(rfcmatches):
|
||||
section_key = "s"+get_doc_section(id)
|
||||
if section_key not in res:
|
||||
|
@ -200,7 +304,7 @@ def agenda_txt(request):
|
|||
def agenda_scribe_template(request):
|
||||
date = TelechatDates.objects.all()[0].date1
|
||||
docs = agenda_docs(date, True)
|
||||
return render_to_response('iesg/scribe_template.html', {'date':str(date), 'docs':docs}, context_instance=RequestContext(request) )
|
||||
return render_to_response('iesg/scribe_template.html', {'date':str(date), 'docs':docs, 'USE_DB_REDESIGN_PROXY_CLASSES': settings.USE_DB_REDESIGN_PROXY_CLASSES}, context_instance=RequestContext(request) )
|
||||
|
||||
def _agenda_moderator_package(request):
|
||||
data = _agenda_data(request)
|
||||
|
@ -235,7 +339,13 @@ def agenda_documents_txt(request):
|
|||
dates = TelechatDates.objects.all()[0].dates()
|
||||
docs = []
|
||||
for date in dates:
|
||||
docs.extend(IDInternal.objects.filter(telechat_date=date, primary_flag=1, agenda=1))
|
||||
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
|
||||
from doc.models import TelechatEvent
|
||||
for d in IDInternal.objects.filter(event__telechatevent__telechat_date=date):
|
||||
if d.latest_event(TelechatEvent, type="scheduled_for_telechat").telechat_date == date:
|
||||
docs.append(d)
|
||||
else:
|
||||
docs.extend(IDInternal.objects.filter(telechat_date=date, primary_flag=1, agenda=1))
|
||||
t = loader.get_template('iesg/agenda_documents.txt')
|
||||
c = Context({'docs':docs})
|
||||
return HttpResponse(t.render(c), mimetype='text/plain')
|
||||
|
@ -284,8 +394,18 @@ def handle_reschedule_form(request, idinternal, dates):
|
|||
|
||||
def agenda_documents(request):
|
||||
dates = TelechatDates.objects.all()[0].dates()
|
||||
idinternals = list(IDInternal.objects.filter(telechat_date__in=dates,primary_flag=1,agenda=1).order_by('rfc_flag', 'ballot'))
|
||||
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
|
||||
from doc.models import TelechatEvent
|
||||
idinternals = []
|
||||
for d in IDInternal.objects.filter(event__telechatevent__telechat_date__in=dates):
|
||||
if d.latest_event(TelechatEvent, type="scheduled_for_telechat").telechat_date in dates:
|
||||
idinternals.append(d)
|
||||
|
||||
idinternals.sort(key=lambda d: (d.rfc_flag, d.start_date))
|
||||
else:
|
||||
idinternals = list(IDInternal.objects.filter(telechat_date__in=dates,primary_flag=1,agenda=1).order_by('rfc_flag', 'ballot'))
|
||||
for i in idinternals:
|
||||
# FIXME: this isn't ported, apparently disabled
|
||||
i.reschedule_form = handle_reschedule_form(request, i, dates)
|
||||
|
||||
# some may have been taken off the schedule by the reschedule form
|
||||
|
@ -302,7 +422,10 @@ def agenda_documents(request):
|
|||
if not i.rfc_flag:
|
||||
w = IdWrapper(draft=i)
|
||||
else:
|
||||
ri = RfcIndex.objects.get(rfc_number=i.draft_id)
|
||||
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
|
||||
ri = i
|
||||
else:
|
||||
ri = RfcIndex.objects.get(rfc_number=i.draft_id)
|
||||
w = RfcWrapper(ri)
|
||||
w.reschedule_form = i.reschedule_form
|
||||
res[section_key].append(w)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# Copyright The IETF Trust 2007, All Rights Reserved
|
||||
|
||||
from django.db import models
|
||||
from django.conf import settings
|
||||
#from django import newforms as forms
|
||||
from ietf.idtracker.views import InternetDraft
|
||||
from ietf.idtracker.models import Rfc
|
||||
|
@ -149,8 +150,8 @@ class IprContact(models.Model):
|
|||
|
||||
|
||||
class IprDraft(models.Model):
|
||||
ipr = models.ForeignKey(IprDetail, related_name='drafts')
|
||||
document = models.ForeignKey(InternetDraft, db_column='id_document_tag', related_name="ipr")
|
||||
ipr = models.ForeignKey(IprDetail, related_name='drafts_old' if settings.USE_DB_REDESIGN_PROXY_CLASSES else 'drafts')
|
||||
document = models.ForeignKey(InternetDraft, db_column='id_document_tag', related_name="ipr_old" if settings.USE_DB_REDESIGN_PROXY_CLASSES else "ipr")
|
||||
revision = models.CharField(max_length=2)
|
||||
def __str__(self):
|
||||
return "%s which applies to %s-%s" % ( self.ipr, self.document, self.revision )
|
||||
|
@ -168,7 +169,7 @@ class IprNotification(models.Model):
|
|||
db_table = 'ipr_notifications'
|
||||
|
||||
class IprRfc(models.Model):
|
||||
ipr = models.ForeignKey(IprDetail, related_name='rfcs')
|
||||
ipr = models.ForeignKey(IprDetail, related_name='rfcs_old' if settings.USE_DB_REDESIGN_PROXY_CLASSES else 'rfcs')
|
||||
document = models.ForeignKey(Rfc, db_column='rfc_number', related_name="ipr")
|
||||
def __str__(self):
|
||||
return "%s applies to RFC%04d" % ( self.ipr, self.document_id )
|
||||
|
@ -184,6 +185,23 @@ class IprUpdate(models.Model):
|
|||
class Meta:
|
||||
db_table = 'ipr_updates'
|
||||
|
||||
|
||||
|
||||
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
|
||||
from doc.models import Document
|
||||
|
||||
class IprDocument(models.Model):
|
||||
ipr = models.ForeignKey(IprDetail, related_name='documents')
|
||||
document = models.ForeignKey(Document, related_name="ipr")
|
||||
rev = models.CharField(max_length=2)
|
||||
def __unicode__(self):
|
||||
if self.rev != None:
|
||||
return u"%s which applies to %s-%s" % (self.ipr, self.document, self.revision)
|
||||
else:
|
||||
return u"%s which applies to %s" % (self.ipr, self.document)
|
||||
|
||||
|
||||
|
||||
# changes done by convert-096.py:changed maxlength to max_length
|
||||
# removed core
|
||||
# removed edit_inline
|
||||
|
|
|
@ -48,11 +48,20 @@ Some parts Copyright (c) 2009 The IETF Trust, all rights reserved.
|
|||
{% endif %}{% for ipr in doc.obj.draft.ipr.all %}{% ifequal ipr.ipr.status 1 %} <br>IPR: <a href="http://datatracker.ietf.org/ipr/{{ ipr.ipr.ipr_id }}/">{{ ipr.ipr.title|escape }}</a>{% endifequal %}
|
||||
{% endfor %} {% if doc.obj.ballot.active %}<br><b>Discusses/comments</b> (from <a href="http://datatracker.ietf.org/idtracker/ballot/{{ doc.obj.ballot.ballot}}/">ballot {{doc.obj.ballot.ballot }})</a>:
|
||||
<ol>
|
||||
{% if USE_DB_REDESIGN_PROXY_CLASSES %}
|
||||
{% for p in doc.obj.active_positions|dictsort:"ad.get_name" %}{% if p.pos %}{% ifequal p.pos.pos_id "discuss" %}<li><a href="#{{doc.obj.document.filename}}+{{p.pos.ad|slugify}}+discuss">{{ p.pos.ad.get_name }}: Discuss [{{ p.pos.discuss_time.date }}]</a>:
|
||||
<br>...
|
||||
{% endifequal %}{% if p.pos.comment %} <li><a href="#{{doc.obj.document.filename}}+{{position.ad|slugify}}+comment">{{ p.pos.ad.get_name }}: Comment [{{ p.pos.comment_time.date }}]</a>:
|
||||
<br>...
|
||||
{% endif %}{% endif %}{% endfor %}
|
||||
{% else %}
|
||||
{% for position in doc.obj.ballot.positions.all|dictsort:"ad.last_name" %}{% ifequal position.discuss 1 %} <li><a href="#{{doc.obj.document.filename}}+{{position.ad|slugify}}+discuss">{{ position.ad }}:{% for item in doc.obj.ballot.discusses.all %}{% ifequal position.ad item.ad %} Discuss [{{ item.date }}]</a>:
|
||||
<br>...
|
||||
{% endifequal %}{% endfor %}{% endifequal %}{% for item in doc.obj.ballot.comments.all %}{% ifequal position.ad item.ad %} <li><a href="#{{doc.obj.document.filename}}+{{position.ad|slugify}}+comment">{{ position.ad }}: Comment [{{ item.date }}]</a>:
|
||||
<br>...
|
||||
{% endifequal %}{% endfor %}{% endfor %} </ol>
|
||||
{% endifequal %}{% endfor %}{% endfor %}
|
||||
{% endif%}
|
||||
</ol>
|
||||
{%endif %} <p><b>Telechat</b>:
|
||||
<ul>
|
||||
<li>...
|
||||
|
|
|
@ -109,7 +109,7 @@ class InternetDraft(Document):
|
|||
@property
|
||||
def lc_expiration_date(self):
|
||||
e = self.latest_event(LastCallEvent, type="sent_last_call")
|
||||
return e.expires if e else None
|
||||
return e.expires.date() if e else None
|
||||
|
||||
#b_sent_date = models.DateField(null=True, blank=True)
|
||||
@property
|
||||
|
@ -142,7 +142,7 @@ class InternetDraft(Document):
|
|||
#last_modified_date = models.DateField()
|
||||
@property
|
||||
def last_modified_date(self):
|
||||
return self.time
|
||||
return self.time.date()
|
||||
|
||||
#replaced_by = models.ForeignKey('self', db_column='replaced_by', blank=True, null=True, related_name='replaces_set')
|
||||
@property
|
||||
|
@ -218,7 +218,7 @@ class InternetDraft(Document):
|
|||
def file_tag(self):
|
||||
return "<%s-%s.txt>" % (self.name, self.revision_display())
|
||||
def group_acronym(self):
|
||||
return self.group.acronym
|
||||
return super(Document, self).group.acronym
|
||||
def idstate(self):
|
||||
return self.docstate()
|
||||
def revision_display(self):
|
||||
|
@ -273,6 +273,10 @@ class InternetDraft(Document):
|
|||
@property
|
||||
def draft(self):
|
||||
return self
|
||||
|
||||
@property
|
||||
def draft_id(self):
|
||||
return self.name
|
||||
|
||||
#rfc_flag = models.IntegerField(null=True)
|
||||
@property
|
||||
|
@ -320,7 +324,8 @@ class InternetDraft(Document):
|
|||
#agenda = models.IntegerField(null=True, blank=True)
|
||||
@property
|
||||
def agenda(self):
|
||||
return bool(self.latest_event(type="scheduled_for_telechat"))
|
||||
e = self.latest_event(TelechatEvent, type="scheduled_for_telechat")
|
||||
return bool(e and e.telechat_date)
|
||||
|
||||
#cur_state = models.ForeignKey(IDState, db_column='cur_state', related_name='docs')
|
||||
@property
|
||||
|
@ -552,7 +557,6 @@ class InternetDraft(Document):
|
|||
def active_positions(self):
|
||||
"""Returns a list of dicts, with AD and Position tuples"""
|
||||
active_ads = Email.objects.filter(role__name="ad", role__group__state="active")
|
||||
|
||||
res = []
|
||||
def add(ad, pos):
|
||||
from person.proxy import IESGLogin as IESGLoginProxy
|
||||
|
@ -567,7 +571,9 @@ class InternetDraft(Document):
|
|||
for ad in active_ads:
|
||||
if ad not in found:
|
||||
add(ad, None)
|
||||
|
||||
|
||||
res.sort(key=lambda x: x["ad"].last_name)
|
||||
|
||||
return res
|
||||
|
||||
def needed(self, standardsTrack=True):
|
||||
|
@ -693,6 +699,20 @@ class InternetDraft(Document):
|
|||
def file_formats(self):
|
||||
return self.get_file_type_matches_from(os.path.join(settings.RFC_PATH, "rfc" + str(self.rfc_number) + ".*")).replace(".", "").replace("txt", "ascii")
|
||||
|
||||
@property
|
||||
def positions(self):
|
||||
res = []
|
||||
found = set()
|
||||
for pos in Position.objects.filter(doc=self, type="changed_ballot_position").select_related('ad').order_by("-time", "-id"):
|
||||
if pos.ad not in found:
|
||||
found.add(pos.ad)
|
||||
res.append(pos)
|
||||
|
||||
class Dummy: pass
|
||||
d = Dummy()
|
||||
d.all = res
|
||||
return d
|
||||
|
||||
class Meta:
|
||||
proxy = True
|
||||
|
||||
|
|
|
@ -59,6 +59,11 @@ class Area(Group):
|
|||
@staticmethod
|
||||
def active_areas():
|
||||
return Area.objects.filter(type="area", state="active").select_related('type', 'state', 'parent').order_by('acronym')
|
||||
|
||||
def __str__(self):
|
||||
return self.acronym
|
||||
def __unicode__(self):
|
||||
return self.acronym
|
||||
|
||||
class Meta:
|
||||
proxy = True
|
||||
|
|
|
@ -4,6 +4,7 @@ class IESGLogin(Email):
|
|||
def from_object(self, base):
|
||||
for f in base._meta.fields:
|
||||
setattr(self, f.name, getattr(base, f.name))
|
||||
return self
|
||||
|
||||
SECRETARIAT_LEVEL = 0
|
||||
AD_LEVEL = 1
|
||||
|
@ -30,7 +31,7 @@ class IESGLogin(Email):
|
|||
#last_name = models.CharField(blank=True, max_length=25)
|
||||
@property
|
||||
def last_name(self):
|
||||
return self.get_name().split(" ")[1]
|
||||
return self.get_name().split(" ")[-1]
|
||||
|
||||
# FIXME: person isn't wrapped yet
|
||||
#person = BrokenForeignKey(PersonOrOrgInfo, db_column='person_or_org_tag', unique=True, null_values=(0, 888888), null=True)
|
||||
|
|
Loading…
Reference in a new issue