Skip to content

Commit f6a55f9

Browse files
committed
Change __str__ representation for a BallotInfo.
Add Positions, IESGComment, IESGDiscuss tables. (These are database tables 'ballots', 'ballots_comment' and ballots_discuss' but I decided to name the classes differently.) - Legacy-Id: 126
1 parent 2edecd6 commit f6a55f9

1 file changed

Lines changed: 56 additions & 1 deletion

File tree

ietf/idtracker/models.py

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,10 +452,65 @@ class BallotInfo(models.Model): # Added by Michael Lee
452452
ballot_writeup = models.TextField(blank=True)
453453
ballot_issued = models.IntegerField(null=True, blank=True)
454454
def __str__(self):
455-
return self.approval_text
455+
try:
456+
return "Ballot for %s" % (IDInternal.objects.get(ballot_id=self.ballot, primary_flag=1).draft.filename)
457+
except IDInternal.DoesNotExist:
458+
return "Ballot ID %d (no I-D?)" % (self.ballot_id)
456459
class Meta:
457460
db_table = 'ballot_info'
461+
class Admin:
462+
pass
463+
464+
class Position(models.Model):
465+
ballot = models.ForeignKey(BallotInfo, raw_id_admin=True, related_name='positions')
466+
ad = models.ForeignKey(IESGLogin, raw_id_admin=True)
467+
yes = models.IntegerField(db_column='yes_col')
468+
noobj = models.IntegerField(db_column='no_col')
469+
abstain = models.IntegerField()
470+
approve = models.IntegerField()
471+
discuss = models.IntegerField()
472+
recuse = models.IntegerField()
473+
def __str__(self):
474+
return "Position for %s on %s" % ( self.ad, self.ballot )
475+
class Meta:
476+
db_table = 'ballots'
477+
unique_together = (('ballot', 'ad'), )
478+
class Admin:
479+
pass
480+
481+
class IESGComment(models.Model):
482+
ballot = models.ForeignKey(BallotInfo, raw_id_admin=True)
483+
ad = models.ForeignKey(IESGLogin, raw_id_admin=True)
484+
comment_date = models.DateField()
485+
revision = models.CharField(maxlength=2)
486+
active = models.IntegerField()
487+
comment_text = models.TextField(blank=True)
488+
def __str__(self):
489+
return "Comment text by %s on %s" % ( self.ad, self.ballot )
490+
class Meta:
491+
db_table = 'ballots_comment'
492+
unique_together = (('ballot', 'ad'), )
493+
verbose_name = 'IESG Comment Text'
494+
verbose_name_plural = 'IESG Comments'
495+
class Admin:
496+
pass
458497

498+
class IESGDiscuss(models.Model):
499+
ballot = models.ForeignKey(BallotInfo, raw_id_admin=True)
500+
ad = models.ForeignKey(IESGLogin, raw_id_admin=True)
501+
discuss_date = models.DateField()
502+
revision = models.CharField(maxlength=2)
503+
active = models.IntegerField()
504+
discuss_text = models.TextField(blank=True)
505+
def __str__(self):
506+
return "Discuss text by %s on %s" % ( self.ad, self.ballot )
507+
class Meta:
508+
db_table = 'ballots_discuss'
509+
unique_together = (('ballot', 'ad'), )
510+
verbose_name = 'IESG Discuss Text'
511+
verbose_name_plural = 'IESG Discusses'
512+
class Admin:
513+
pass
459514

460515
class IDAuthors(models.Model):
461516
document = models.ForeignKey(InternetDraft, db_column='id_document_tag', related_name='authors', edit_inline=models.TABULAR)

0 commit comments

Comments
 (0)