A Ballot view which is good enough to deploy, I believe. The major

difference is that current ADs are not shown as part of old ballots.
 - Legacy-Id: 178
This commit is contained in:
Henrik Levkowetz 2007-05-29 00:04:57 +00:00
parent e38f1dc967
commit 380546ac46
3 changed files with 49 additions and 17 deletions

View file

@ -377,6 +377,9 @@ class BallotInfo(models.Model): # Added by Michael Lee
return "Ballot for %s" % self.drafts.filter(primary_flag=1)
except IDInternal.DoesNotExist:
return "Ballot ID %d (no I-D?)" % (self.ballot)
def remarks(self):
remarks = list(self.discusses.all()) + list(self.comments.all())
return remarks
class Meta:
db_table = 'ballot_info'
class Admin:
@ -500,13 +503,10 @@ class Position(models.Model):
return "Position for %s on %s" % ( self.ad, self.ballot )
def abstain_ind(self):
if self.recuse:
log('R: %s' % self.ad)
return 'R'
if self.abstain:
log('X: %s' % self.ad)
return 'X'
else:
log('_: %s' % self.ad)
return ' '
class Meta:
db_table = 'ballots'
@ -517,12 +517,14 @@ class Position(models.Model):
class IESGComment(models.Model):
ballot = models.ForeignKey(BallotInfo, raw_id_admin=True, related_name="comments")
ad = models.ForeignKey(IESGLogin, raw_id_admin=True)
comment_date = models.DateField()
date = models.DateField(db_column="comment_date")
revision = models.CharField(maxlength=2)
active = models.IntegerField()
comment_text = models.TextField(blank=True)
text = models.TextField(blank=True, db_column="comment_text")
def __str__(self):
return "Comment text by %s on %s" % ( self.ad, self.ballot )
def is_comment(self):
return True
class Meta:
db_table = 'ballots_comment'
unique_together = (('ballot', 'ad'), )
@ -534,12 +536,14 @@ class IESGComment(models.Model):
class IESGDiscuss(models.Model):
ballot = models.ForeignKey(BallotInfo, raw_id_admin=True, related_name="discusses")
ad = models.ForeignKey(IESGLogin, raw_id_admin=True)
discuss_date = models.DateField()
date = models.DateField(db_column="discuss_date")
revision = models.CharField(maxlength=2)
active = models.IntegerField()
discuss_text = models.TextField(blank=True)
text = models.TextField(blank=True, db_column="discuss_text")
def __str__(self):
return "Discuss text by %s on %s" % ( self.ad, self.ballot )
def is_discuss(self):
return True
class Meta:
db_table = 'ballots_discuss'
unique_together = (('ballot', 'ad'), )

View file

@ -1,3 +1,4 @@
import textwrap
from django import template
from django.utils.html import escape, fix_ampersands, linebreaks
from django.template.defaultfilters import linebreaksbr
@ -6,6 +7,7 @@ try:
except ImportError:
from email import Utils as emailutils
import re
from ietf.utils import log
register = template.Library()
@ -94,7 +96,27 @@ def square_brackets(value):
"""Adds square brackets around text."""
if type(value) == type(""):
return "[ %s ]" % value
elif value:
elif value > 0:
return "[ X ]"
elif value < 0:
return "[ . ]"
else:
return "[ ]"
@register.filter(name='fill')
def fill(text, width):
"""Wraps the single paragraph in text (a string) so every line
is at most width characters long, and returns a single string
containing the wrapped paragraph.
"""
width = int(width)
paras = text.replace("\r\n","\n").replace("\r","\n").split("\n\n")
wrapped = []
for para in paras:
if para:
lines = para.split("\n")
maxlen = max([len(line) for line in lines])
if maxlen > width:
para = textwrap.fill(para, width, replace_whitespace=False)
wrapped.append(para)
return "\n\n".join(wrapped)

View file

@ -8,11 +8,12 @@
To: Internet Engineering Steering Group &lt;iesg@ietf.org&gt;
From: IESG Secretary &lt;iesg-secretary@ietf.org&gt;
Reply-To: IESG Secretary &lt;iesg-secretary@ietf.org&gt;
Subject: Evaluation:{% for id in object.drafts.all %} {{ id.draft.filename }}-{{ id.draft.revision }}.txt to {{ id.draft.intended_status }} {% endfor %}
Subject: Evaluation: {% for id in object.drafts.all %}{{ id.draft.filename }}-{{ id.draft.revision }}.txt to {{ id.draft.intended_status }}
{% endfor %}
--------
Evaluation for:{% for id in object.drafts.all %} {{ id.draft.filename }}-{{ id.draft.revision }}.txt
{% endfor %}can be found at http://datatracker.ietf.org/idtracker/ballot/{{ object.ballot }}/ <!-- FIXME: hardcoded URL -->
Evaluation for{% for id in object.drafts.all %} {{ id.draft.filename }}-{{ id.draft.revision }}.txt {% endfor %}can be found at
http://datatracker.ietf.org/idtracker/ballot/{{ object.ballot }}/ <!-- FIXME: hardcoded URL -->
{% if object.drafts.all.0.draft.lc_expiration_date %}
Last Call to expire on: {{ object.drafts.all.0.draft.lc_expiration_date|escape }}
{% endif %}
@ -27,15 +28,20 @@ with no "Discuss" positions, are needed for approval.
DISCUSSES AND COMMENTS:
======================
{% for item in object.discusses.all %}{{ item.ad }}:
{{ item }}
{% for position in object.positions.all|dictsort:"ad.last_name" %}{% ifequal position.discuss 1 %}{{ position.ad }}:{% for item in object.discusses.all %}{% ifequal position.ad item.ad %}
{% endfor %}
{% for item in object.comments.all %}{{ item.ad }}:
{{ item }}
Discuss [{{ item.date }}]:
{{ item.text|fill:"80"|escape }}
{% endfor %}
{% endifequal %}{% endfor %}{% endifequal %}{% for item in object.comments.all %}{% ifequal position.ad item.ad %}{% ifnotequal position.discuss 1 %}{{ position.ad }}:
{% endifnotequal %}Comment [{{ item.date }}]:
{{ item.text|fill:"80"|escape }}
{% endifequal %}{% endfor %}{% endfor %}
^L
---- following is a DRAFT of message to be sent AFTER approval ---
{{ object.approval_text|escape|urlize }}