First cut at a ballot view. Comment and Discuss text is missing.

- Legacy-Id: 172
This commit is contained in:
Henrik Levkowetz 2007-05-28 09:23:45 +00:00
parent 51a3214d96
commit 003d730cd7
4 changed files with 90 additions and 35 deletions

View file

@ -1,5 +1,5 @@
from django.db import models
from ietf.utils import FKAsOneToOne
from ietf.utils import FKAsOneToOne, log
class Acronym(models.Model):
acronym_id = models.AutoField(primary_key=True)
@ -244,7 +244,8 @@ class IESGLogin(models.Model):
pgp_id = models.CharField(blank=True, maxlength=20)
default_search = models.IntegerField(null=True)
def __str__(self):
return "%s, %s" % ( self.last_name, self.first_name)
#return "%s, %s" % ( self.last_name, self.first_name)
return "%s %s" % ( self.first_name, self.last_name)
class Meta:
db_table = 'iesg_login'
class Admin:
@ -352,6 +353,31 @@ class RfcObsolete(models.Model):
## End RFC Tables
class BallotInfo(models.Model): # Added by Michael Lee
ballot = models.AutoField(primary_key=True, db_column='ballot_id')
active = models.BooleanField()
an_sent = models.BooleanField()
an_sent_date = models.DateField(null=True, blank=True)
an_sent_by = models.ForeignKey(IESGLogin, db_column='an_sent_by', related_name='ansent')
defer = models.BooleanField(null=True, blank=True)
defer_by = models.ForeignKey(IESGLogin, db_column='defer_by', related_name='deferred')
defer_date = models.DateField(null=True, blank=True)
approval_text = models.TextField(blank=True)
last_call_text = models.TextField(blank=True)
ballot_writeup = models.TextField(blank=True)
ballot_issued = models.IntegerField(null=True, blank=True)
def __str__(self):
try:
return "Ballot for %s" % IDInternal.objects.get(ballot=self.ballot, primary_flag=1).draft.filename
except IDInternal.DoesNotExist:
return "Ballot ID %d (no I-D?)" % (self.ballot_id)
# def drafts(self):
# return ", ".join([ "%s-%s.txt" % (item.draft.filename, item.draft.revision) for item in IDInternal.objects.filter(ballot_id=self.ballot, primary_flag=1)])
class Meta:
db_table = 'ballot_info'
class Admin:
pass
class IDInternal(models.Model):
"""
An IDInternal represents a document that has been added to the
@ -367,7 +393,8 @@ class IDInternal(models.Model):
"""
draft = models.ForeignKey(InternetDraft, primary_key=True, unique=True, db_column='id_document_tag')
rfc_flag = models.IntegerField(null=True)
ballot_id = models.IntegerField()
#ballot_id = models.IntegerField()
ballot = models.ForeignKey(BallotInfo, related_name='drafts')
primary_flag = models.IntegerField()
group_flag = models.IntegerField(blank=True)
token_name = models.CharField(blank=True, maxlength=25)
@ -456,29 +483,6 @@ class DocumentComment(models.Model):
class Meta:
db_table = 'document_comments'
class BallotInfo(models.Model): # Added by Michael Lee
ballot = models.AutoField(primary_key=True, db_column='ballot_id')
active = models.BooleanField()
an_sent = models.BooleanField()
an_sent_date = models.DateField(null=True, blank=True)
an_sent_by = models.ForeignKey(IESGLogin, db_column='an_sent_by', related_name='ansent')
defer = models.BooleanField(null=True, blank=True)
defer_by = models.ForeignKey(IESGLogin, db_column='defer_by', related_name='deferred')
defer_date = models.DateField(null=True, blank=True)
approval_text = models.TextField(blank=True)
last_call_text = models.TextField(blank=True)
ballot_writeup = models.TextField(blank=True)
ballot_issued = models.IntegerField(null=True, blank=True)
def __str__(self):
try:
return "Ballot for %s" % (IDInternal.objects.get(ballot_id=self.ballot, primary_flag=1).draft.filename)
except IDInternal.DoesNotExist:
return "Ballot ID %d (no I-D?)" % (self.ballot_id)
class Meta:
db_table = 'ballot_info'
class Admin:
pass
class Position(models.Model):
ballot = models.ForeignKey(BallotInfo, raw_id_admin=True, related_name='positions')
ad = models.ForeignKey(IESGLogin, raw_id_admin=True)
@ -490,21 +494,32 @@ class Position(models.Model):
recuse = models.IntegerField()
def __str__(self):
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'
unique_together = (('ballot', 'ad'), )
class Admin:
pass
class IESGComment(models.Model):
ballot = models.ForeignKey(BallotInfo, raw_id_admin=True)
ballot = models.ForeignKey(BallotInfo, raw_id_admin=True, related_name="comments")
ad = models.ForeignKey(IESGLogin, raw_id_admin=True)
comment_date = models.DateField()
revision = models.CharField(maxlength=2)
active = models.IntegerField()
comment_text = models.TextField(blank=True)
def __str__(self):
return "Comment text by %s on %s" % ( self.ad, self.ballot )
return "Comment text by %s on %s" % ( self.ad, str(self.ballot) )
class Meta:
db_table = 'ballots_comment'
unique_together = (('ballot', 'ad'), )
@ -514,7 +529,7 @@ class IESGComment(models.Model):
pass
class IESGDiscuss(models.Model):
ballot = models.ForeignKey(BallotInfo, raw_id_admin=True)
ballot = models.ForeignKey(BallotInfo, db_column="ballot_id", raw_id_admin=True, related_name="discusses")
ad = models.ForeignKey(IESGLogin, raw_id_admin=True)
discuss_date = models.DateField()
revision = models.CharField(maxlength=2)

View file

@ -1,5 +1,5 @@
from django.conf.urls.defaults import *
from ietf.idtracker.models import IDInternal, IDState, IDSubState, DocumentComment
from ietf.idtracker.models import IDInternal, IDState, IDSubState, DocumentComment, BallotInfo
from ietf.idtracker import views
id_dict = {
@ -12,6 +12,10 @@ comment_dict = {
'queryset': DocumentComment.objects.all().filter(public_flag=1),
}
ballot_dict = {
'queryset': BallotInfo.objects.all()
}
urlpatterns = patterns('django.views.generic.simple',
(r'^states/$', 'direct_to_template', { 'template': 'idtracker/states.html', 'extra_context': { 'states': IDState.objects.all(), 'substates': IDSubState.objects.all() } }),
(r'^ballot_key/$', 'direct_to_template', { 'template': 'idtracker/view_key.html' }),
@ -22,6 +26,7 @@ urlpatterns += patterns('django.views.generic.list_detail',
(r'^(?P<object_id>\d+)/$', 'object_detail', id_dict),
(r'^(?P<slug>[^/]+)/$', 'object_detail', dict(id_dict, slug_field='draft__filename')),
(r'^comment/(?P<object_id>\d+)/$', 'object_detail', comment_dict),
(r'^ballot/(?P<object_id>\d+)/$', 'object_detail', ballot_dict),
)
urlpatterns += patterns('',
(r'^(?P<slug>[^/]+)/comment/(?P<object_id>\d+)/$', views.comment, comment_dict),

View file

@ -1,10 +1,45 @@
{% extends "base.html" %}
{% extends "idtracker/base.html" %}
{% load ietf_filters %}
{% block title %}IESG Announcement{% endblock %}
{% block content %}
{{ object.approval_text|escape|keep_spacing|urlize|linebreaks }}
{{ object.ballot_writeup|escape|keep_spacing|urlize|linebreaks }}
{% block idcontent %}
<pre>
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 %}
--------
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 %}
Please return the full line with your position.
Yes No-Objection Discuss Abstain
{% for position in object.positions.all|dictsort:"ad.last_name" %}{{ position.ad|ljust:"20" }} {{ position.yes|bracket }} {{ position.noobj|bracket }} {{ position.discuss|bracket }} {{ position.abstain_ind|bracket }}
{% endfor %}
"Yes" or "No-Objection" positions from 2/3 of non-recused ADs,
with no "Discuss" positions, are needed for approval.
DISCUSSES AND COMMENTS:
======================
{% for item in object.discusses.all %}{{ item.ad }}:
{{ item }}
{% endfor %}
{% for item in object.comments.all %}{{ item.ad }}:
{{ item }}
{% endfor %}
---- following is a DRAFT of message to be sent AFTER approval ---
{{ object.approval_text|escape|urlize }}
{{ object.ballot_writeup|escape|urlize }}
</pre>
{% endblock %}

View file

@ -57,7 +57,7 @@
<td>
{# what's the "if" here #}
<div class="largefont3">
<a href="ballot/">IESG evaluation record</a>
<a href="../ballot/{{ object.ballot_id }}">IESG evaluation record</a>
[<a href="/idtracker/evaluation_process/">What
they mean</a>]
[<a href="/idtracker/ballot_key/">How they are