Add choices() static functions to gather common choices
for select boxes. Make BallotInfo's primary key an AutoField. - Legacy-Id: 123
This commit is contained in:
parent
2739083fbe
commit
561c97bc72
|
@ -35,6 +35,9 @@ class IDState(models.Model):
|
||||||
description = models.TextField(blank=True, db_column='document_desc')
|
description = models.TextField(blank=True, db_column='document_desc')
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.state
|
return self.state
|
||||||
|
def choices():
|
||||||
|
return [(state.document_state_id, state.state) for state in IDState.objects.all()]
|
||||||
|
choices = staticmethod(choices)
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'ref_doc_states_new'
|
db_table = 'ref_doc_states_new'
|
||||||
class Admin:
|
class Admin:
|
||||||
|
@ -436,7 +439,7 @@ class DocumentComment(models.Model):
|
||||||
db_table = 'document_comments'
|
db_table = 'document_comments'
|
||||||
|
|
||||||
class BallotInfo(models.Model): # Added by Michael Lee
|
class BallotInfo(models.Model): # Added by Michael Lee
|
||||||
ballot = models.IntegerField(primary_key=True, db_column='ballot_id')
|
ballot = models.AutoField(primary_key=True, db_column='ballot_id')
|
||||||
active = models.BooleanField()
|
active = models.BooleanField()
|
||||||
an_sent = models.BooleanField()
|
an_sent = models.BooleanField()
|
||||||
an_sent_date = models.DateField(null=True, blank=True)
|
an_sent_date = models.DateField(null=True, blank=True)
|
||||||
|
@ -571,6 +574,9 @@ class GroupIETF(models.Model):
|
||||||
return self.group_acronym.acronym
|
return self.group_acronym.acronym
|
||||||
def active_drafts(self):
|
def active_drafts(self):
|
||||||
return self.group_acronym.internetdraft_set.all().filter(status__status="Active")
|
return self.group_acronym.internetdraft_set.all().filter(status__status="Active")
|
||||||
|
def choices():
|
||||||
|
return [(wg.group_acronym_id, wg.group_acronym.acronym) for wg in GroupIETF.objects.all().select_related().order_by('acronym.acronym')]
|
||||||
|
choices = staticmethod(choices)
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'groups_ietf'
|
db_table = 'groups_ietf'
|
||||||
ordering = ['?'] # workaround django wanting to sort by acronym but not joining with it
|
ordering = ['?'] # workaround django wanting to sort by acronym but not joining with it
|
||||||
|
|
Loading…
Reference in a new issue