From 4e3769c963ad5c0486986e5028e3f2e853e04226 Mon Sep 17 00:00:00 2001 From: Bill Fenner Date: Fri, 8 Jun 2007 18:12:23 +0000 Subject: [PATCH] Turn post_admin and archive_private into IntegerField instead of BooleanField. They are used as booleans, but represented in the database as integers, so pretending they're boolean causes trouble when saving empty values. - Legacy-Id: 266 --- ietf/mailinglists/models.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ietf/mailinglists/models.py b/ietf/mailinglists/models.py index 27e03834b..2ef3756d0 100644 --- a/ietf/mailinglists/models.py +++ b/ietf/mailinglists/models.py @@ -67,6 +67,10 @@ class MailingList(models.Model): (1, 'List members only'), (2, 'Open'), ) + YESNO_CHOICES = ( + (0, 'NO'), + (1, 'YES'), + ) # for integer "boolean" fields mailing_list_id = models.CharField('Unique ID', primary_key=True, maxlength=25, editable=False) request_date = models.DateField(default=datetime.now, editable=False) requestor = models.CharField("Requestor's full name", maxlength=250) @@ -81,8 +85,8 @@ class MailingList(models.Model): welcome_new = models.TextField('Provide a welcome message for new subscriber(s)(optional)', blank=True) subscription = models.IntegerField('What steps are required for subscription?', choices=SUBSCRIPTION_CHOICES) post_who = models.IntegerField('Messages to this list can be posted by', choices=POSTWHO_CHOICES) - post_admin = models.BooleanField('Do postings need to be approved by an administrator?') - archive_private = models.BooleanField('Are the archives private?') + post_admin = models.IntegerField('Do postings need to be approved by an administrator?', default=0, choices=YESNO_CHOICES) + archive_private = models.IntegerField('Are the archives private?', default=0, choices=YESNO_CHOICES) archive_remote = models.TextField('Provide specific information about how to access and move the existing archive (optional)', blank=True) add_comment = models.TextField(blank=True) mail_type = models.IntegerField(choices=MAILTYPE_CHOICES)