Skip to content

Commit e4a9d8c

Browse files
committed
Finish ballot support for charters (apart from non-generic ballot
deferral), remove a bunch of now obsolete charter code. - Legacy-Id: 4255
1 parent a9817e5 commit e4a9d8c

59 files changed

Lines changed: 1939 additions & 2354 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ietf/doc/admin.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,15 @@ def state(self, instance):
104104
admin.site.register(DocHistory, DocHistoryAdmin)
105105

106106
class DocAliasAdmin(admin.ModelAdmin):
107-
list_display = [ 'name', 'document_link', ]
108-
search_fields = [ 'name', 'document__name', ]
107+
list_display = ['name', 'document_link']
108+
search_fields = ['name', 'document__name']
109109
raw_id_fields = ['document']
110110
document_link = admin_link("document")
111111
admin.site.register(DocAlias, DocAliasAdmin)
112112

113-
114-
admin.site.register(BallotType)
113+
class BallotTypeAdmin(admin.ModelAdmin):
114+
list_display = ["slug", "doc_type", "name", "question"]
115+
admin.site.register(BallotType, BallotTypeAdmin)
115116

116117
# events
117118

ietf/doc/migrations/0001_initial.py

Lines changed: 690 additions & 0 deletions
Large diffs are not rendered by default.

ietf/doc/migrations/0002_auto__add_field_ballotpositiondocevent_ballot.py

Lines changed: 381 additions & 0 deletions
Large diffs are not rendered by default.

ietf/doc/migrations/__init__.py

Whitespace-only changes.

ietf/doc/models.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class StateType(models.Model):
1515
label = models.CharField(max_length=255, help_text="Label that should be used (e.g. in admin) for state drop-down for this type of state") # State, IESG state, WG state, ...
1616

1717
def __unicode__(self):
18-
return self.label
18+
return self.slug
1919

2020
class State(models.Model):
2121
type = models.ForeignKey(StateType)
@@ -374,14 +374,6 @@ class TelechatDocEvent(DocEvent):
374374
telechat_date = models.DateField(blank=True, null=True)
375375
returning_item = models.BooleanField(default=False)
376376

377-
# Charter ballot events
378-
class GroupBallotPositionDocEvent(DocEvent):
379-
ad = models.ForeignKey(Person)
380-
pos = models.ForeignKey(GroupBallotPositionName, verbose_name="position", default="norecord")
381-
block_comment = models.TextField(help_text="Blocking comment if position is comment", blank=True)
382-
block_comment_time = models.DateTimeField(help_text="Blocking comment was written", blank=True, null=True)
383-
comment = models.TextField(help_text="Non-blocking comment", blank=True)
384-
comment_time = models.DateTimeField(help_text="Time non-blocking comment was written", blank=True, null=True)
385-
377+
# charter events
386378
class InitialReviewDocEvent(DocEvent):
387379
expires = models.DateTimeField(blank=True, null=True)

ietf/doc/proxy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ class Meta:
817817
class Position(BallotPositionDocEvent):
818818
def from_object(self, base):
819819
for f in base._meta.fields:
820-
if not f.name in ('discuss',): # don't overwrite properties
820+
if not f.name in ('discuss', 'ballot'): # don't overwrite properties
821821
setattr(self, f.name, getattr(base, f.name))
822822
return self
823823

ietf/doc/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ def needed_ballot_positions(doc, active_positions):
8686
answer.append("Needs %d more positions." % more)
8787
else:
8888
if blocking:
89-
answer.append("Has enough positions to pass.")
89+
answer.append("Has enough positions to pass once %s positions are resolved." % blocking[0].pos.name.upper())
9090
else:
91-
answer.append("Has enough positions to pass once %s positions are resolved." % blocking[0].name.upper())
91+
answer.append("Has enough positions to pass.")
9292

9393
return " ".join(answer)
9494

ietf/idrfc/templatetags/ballot_icon.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,15 @@ def render_ballot_icon(context, doc):
7575
name = doc.document().filename()
7676
else:
7777
name = doc.document().filename
78-
tracker_id = doc.draft_id
7978
else:
8079
if doc.in_ietf_process() and doc.ietf_process.has_active_iesg_ballot():
8180
ballot = doc._idinternal.ballot
8281
else:
8382
return ""
8483
if doc.is_rfc_wrapper:
8584
name = "rfc"+str(doc.rfc_number)
86-
tracker_id = doc.rfc_number
8785
else:
8886
name = doc.draft_name
89-
tracker_id = doc.tracker_id
9087
adId = get_user_adid(context)
9188
red = 0
9289
green = 0
@@ -109,10 +106,15 @@ def render_ballot_icon(context, doc):
109106
blank = blank + 1
110107
if adId and (p['ad'].id == adId):
111108
my = position_to_string(p['pos'])
112-
return render_ballot_icon2(name, tracker_id, red,yellow,green,gray,blank, my, adId)+"<!-- adId="+str(adId)+" my="+str(my)+"-->"
109+
return render_ballot_icon2(name, red,yellow,green,gray,blank, my, adId)+"<!-- adId="+str(adId)+" my="+str(my)+"-->"
113110

114-
def render_ballot_icon2(draft_name, tracker_id, red,yellow,green,gray,blank, my,adId):
115-
edit_position_url = urlreverse('doc_edit_position', kwargs=dict(name=draft_name))
111+
def render_ballot_icon2(draft_name, red,yellow,green,gray,blank, my,adId):
112+
from ietf.doc.models import BallotDocEvent
113+
ballots = BallotDocEvent.objects.filter(doc__docalias__name=draft_name).order_by("-time", "-id")
114+
if ballots:
115+
edit_position_url = urlreverse('doc_edit_position', kwargs=dict(name=draft_name, ballot_id=ballots[0].pk))
116+
else:
117+
edit_position_url = ""
116118
if adId:
117119
res_cm = ' oncontextmenu="editBallot(\''+str(edit_position_url)+'\');return false;"'
118120
else:

ietf/idrfc/testsREDESIGN.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,8 @@ class EditPositionTestCase(django.test.TestCase):
418418

419419
def test_edit_position(self):
420420
draft = make_test_data()
421-
url = urlreverse('doc_edit_position', kwargs=dict(name=draft.name))
421+
url = urlreverse('doc_edit_position', kwargs=dict(name=draft.name,
422+
ballot_id=draft.latest_event(BallotDocEvent, type="created_ballot").pk))
422423
login_testing_unauthorized(self, "ad", url)
423424

424425
ad = Person.objects.get(name="Aread Irector")
@@ -479,7 +480,8 @@ def test_edit_position(self):
479480

480481
def test_edit_position_as_secretary(self):
481482
draft = make_test_data()
482-
url = urlreverse('doc_edit_position', kwargs=dict(name=draft.name))
483+
url = urlreverse('doc_edit_position', kwargs=dict(name=draft.name,
484+
ballot_id=draft.latest_event(BallotDocEvent, type="created_ballot").pk))
483485
ad = Person.objects.get(name="Aread Irector")
484486
url += "?ad=%s" % ad.pk
485487
login_testing_unauthorized(self, "secretary", url)
@@ -507,13 +509,16 @@ def test_send_ballot_comment(self):
507509
draft.save()
508510

509511
ad = Person.objects.get(name="Aread Irector")
510-
512+
513+
ballot = draft.latest_event(BallotDocEvent, type="created_ballot")
514+
511515
BallotPositionDocEvent.objects.create(doc=draft, type="changed_ballot_position",
512-
by=ad, ad=ad, pos=BallotPositionName.objects.get(slug="yes"),
513-
comment="Test!",
514-
comment_time=datetime.datetime.now())
516+
by=ad, ballot=ballot, ad=ad, pos=BallotPositionName.objects.get(slug="yes"),
517+
comment="Test!",
518+
comment_time=datetime.datetime.now())
515519

516-
url = urlreverse('doc_send_ballot_comment', kwargs=dict(name=draft.name))
520+
url = urlreverse('doc_send_ballot_comment', kwargs=dict(name=draft.name,
521+
ballot_id=ballot.pk))
517522
login_testing_unauthorized(self, "ad", url)
518523

519524
# normal get
@@ -670,10 +675,13 @@ def test_issue_ballot(self):
670675
url = urlreverse('doc_ballot_writeupnotes', kwargs=dict(name=draft.name))
671676
login_testing_unauthorized(self, "ad", url)
672677

678+
ballot = draft.latest_event(BallotDocEvent, type="created_ballot")
679+
673680
def create_pos(num, vote, comment="", discuss=""):
674681
ad = Person.objects.get(name="Ad No%s" % num)
675682
e = BallotPositionDocEvent()
676683
e.doc = draft
684+
e.ballot = ballot
677685
e.by = ad
678686
e.ad = ad
679687
e.pos = BallotPositionName.objects.get(slug=vote)

ietf/idrfc/views_ballot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def edit_positionREDESIGN(request, name, ballot_id):
240240
if 'HTTP_REFERER' in request.META:
241241
return_to_url = request.META['HTTP_REFERER']
242242
else:
243-
return_to_url = urlreverse("doc_ballot", kwargs=dict(name=doc.name, ballot=ballot_id))
243+
return_to_url = urlreverse("doc_ballot", kwargs=dict(name=doc.name, ballot_id=ballot_id))
244244

245245
# if we're in the Secretariat, we can select an AD to act as stand-in for
246246
if not has_role(request.user, "Area Director"):
@@ -447,12 +447,12 @@ def send_ballot_commentREDESIGN(request, name, ballot_id):
447447

448448
return_to_url = request.GET.get('return_to_url')
449449
if not return_to_url:
450-
return_to_url = urlreverse("doc_ballot", kwargs=dict(name=doc.name, ballot=ballot_id))
450+
return_to_url = urlreverse("doc_ballot", kwargs=dict(name=doc.name, ballot_id=ballot_id))
451451

452452
if 'HTTP_REFERER' in request.META:
453453
back_url = request.META['HTTP_REFERER']
454454
else:
455-
back_url = urlreverse("doc_ballot", kwargs=dict(name=doc.name, ballot=ballot_id))
455+
back_url = urlreverse("doc_ballot", kwargs=dict(name=doc.name, ballot_id=ballot_id))
456456

457457
# if we're in the Secretariat, we can select an AD to act as stand-in for
458458
if not has_role(request.user, "Area Director"):

0 commit comments

Comments
 (0)