Increased the length of the list Subscribed email field from 64 to 128, updated the import_mailman_listinfo management command, and added a migration for the model change.
- Legacy-Id: 16370
This commit is contained in:
parent
5e09c5a0aa
commit
e60a3e74f8
|
@ -1,4 +1,4 @@
|
|||
# Copyright The IETF Trust 2016, All Rights Reserved
|
||||
# Copyright The IETF Trust 2016-2019, All Rights Reserved
|
||||
|
||||
import sys
|
||||
from textwrap import dedent
|
||||
|
@ -35,6 +35,8 @@ def import_mailman_listinfo(verbosity=0):
|
|||
|
||||
names = list(Utils.list_names())
|
||||
names.sort()
|
||||
addr_max_length = Subscribed._meta.get_field('email').max_length
|
||||
debug.show('addr_max_length')
|
||||
for name in names:
|
||||
mlist = MailList.MailList(name, lock=False)
|
||||
note("List: %s" % mlist.internal_name())
|
||||
|
@ -62,7 +64,7 @@ def import_mailman_listinfo(verbosity=0):
|
|||
note(" Removing address with no subscriptions: %s" % (addr))
|
||||
old.delete()
|
||||
for addr in members:
|
||||
if len(addr) > 64:
|
||||
if len(addr) > addr_max_length:
|
||||
sys.stderr.write(" ** Email address subscribed to '%s' too long for table: <%s>\n" % (name, addr))
|
||||
continue
|
||||
if not addr in known:
|
||||
|
|
22
ietf/mailinglists/migrations/0002_auto_20190703_1344.py
Normal file
22
ietf/mailinglists/migrations/0002_auto_20190703_1344.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright The IETF Trust 2019, All Rights Reserved
|
||||
# Generated by Django 1.11.22 on 2019-07-03 13:44
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('mailinglists', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='subscribed',
|
||||
name='email',
|
||||
field=models.CharField(max_length=128, validators=[django.core.validators.EmailValidator()]),
|
||||
),
|
||||
]
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright The IETF Trust 2016, All Rights Reserved
|
||||
# Copyright The IETF Trust 2016-2019, All Rights Reserved
|
||||
|
||||
|
||||
from django.conf import settings
|
||||
|
@ -19,7 +19,7 @@ class List(models.Model):
|
|||
|
||||
class Subscribed(models.Model):
|
||||
time = models.DateTimeField(auto_now_add=True)
|
||||
email = models.CharField(max_length=64, validators=[validate_email])
|
||||
email = models.CharField(max_length=128, validators=[validate_email])
|
||||
lists = models.ManyToManyField(List)
|
||||
def __unicode__(self):
|
||||
return "<Subscribed: %s at %s>" % (self.email, self.time)
|
||||
|
|
Loading…
Reference in a new issue