Skip to content

Commit 4e3769c

Browse files
committed
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
1 parent d6b6f38 commit 4e3769c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

ietf/mailinglists/models.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ class MailingList(models.Model):
6767
(1, 'List members only'),
6868
(2, 'Open'),
6969
)
70+
YESNO_CHOICES = (
71+
(0, 'NO'),
72+
(1, 'YES'),
73+
) # for integer "boolean" fields
7074
mailing_list_id = models.CharField('Unique ID', primary_key=True, maxlength=25, editable=False)
7175
request_date = models.DateField(default=datetime.now, editable=False)
7276
requestor = models.CharField("Requestor's full name", maxlength=250)
@@ -81,8 +85,8 @@ class MailingList(models.Model):
8185
welcome_new = models.TextField('Provide a welcome message for new subscriber(s)(optional)', blank=True)
8286
subscription = models.IntegerField('What steps are required for subscription?', choices=SUBSCRIPTION_CHOICES)
8387
post_who = models.IntegerField('Messages to this list can be posted by', choices=POSTWHO_CHOICES)
84-
post_admin = models.BooleanField('Do postings need to be approved by an administrator?')
85-
archive_private = models.BooleanField('Are the archives private?')
88+
post_admin = models.IntegerField('Do postings need to be approved by an administrator?', default=0, choices=YESNO_CHOICES)
89+
archive_private = models.IntegerField('Are the archives private?', default=0, choices=YESNO_CHOICES)
8690
archive_remote = models.TextField('Provide specific information about how to access and move the existing archive (optional)', blank=True)
8791
add_comment = models.TextField(blank=True)
8892
mail_type = models.IntegerField(choices=MAILTYPE_CHOICES)

0 commit comments

Comments
 (0)