Port mailinglist view, expand group importer a bit

- Legacy-Id: 3159
This commit is contained in:
Ole Laursen 2011-05-27 11:46:54 +00:00
parent 215d4ff9fd
commit 68d0e4c801
4 changed files with 36 additions and 8 deletions
ietf/mailinglists
redesign

View file

@ -1,10 +1,17 @@
# Copyright The IETF Trust 2007, All Rights Reserved
from django.conf.urls.defaults import patterns
from django.conf import settings
from ietf.idtracker.models import IETFWG
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
from redesign.group.proxy import IETFWG
http_archive_wg_queryset = IETFWG.objects.filter(list_pages__startswith='http')
else:
http_archive_wg_queryset = IETFWG.objects.filter(email_archive__startswith='http')
urlpatterns = patterns('django.views.generic.list_detail',
(r'^wg/$', 'object_list', { 'queryset': IETFWG.objects.filter(email_archive__startswith='http'), 'template_name': 'mailinglists/wgwebmail_list.html' }),
(r'^wg/$', 'object_list', { 'queryset': http_archive_wg_queryset, 'template_name': 'mailinglists/wgwebmail_list.html' }),
)
urlpatterns += patterns('',
(r'^nonwg/$', 'django.views.generic.simple.redirect_to', { 'url': 'http://www.ietf.org/list/nonwg.html'}),

View file

@ -14,7 +14,7 @@ class Group(models.Model):
charter = models.OneToOneField('doc.Document', related_name='chartered_group', blank=True, null=True)
parent = models.ForeignKey('Group', blank=True, null=True)
list_email = models.CharField(max_length=64, blank=True)
list_pages = models.CharField(max_length=64, blank=True)
list_pages = models.CharField(max_length=255, blank=True)
comments = models.TextField(blank=True)
def __unicode__(self):
return self.name

View file

@ -85,9 +85,15 @@ class IETFWG(Group):
#area_director = models.ForeignKey(AreaDirector, null=True)
#meeting_scheduled = models.CharField(blank=True, max_length=3)
#email_address = models.CharField(blank=True, max_length=60)
@property
def email_address(self):
return self.list_email
#email_subscribe = models.CharField(blank=True, max_length=120)
#email_keyword = models.CharField(blank=True, max_length=50)
#email_archive = models.CharField(blank=True, max_length=95)
@property
def email_archive(self):
return self.list_pages
#comments = models.TextField(blank=True)
#last_modified_date = models.DateField()
#meeting_scheduled_old = models.CharField(blank=True, max_length=3)

View file

@ -67,11 +67,11 @@ system = Person.objects.get(name="(System)")
# NomCom
Group.objects.filter(acronym__startswith="nomcom").exclude(acronym="nomcom").delete()
#Group.objects.filter(acronym__startswith="nomcom").exclude(acronym="nomcom").delete()
for o in ChairsHistory.objects.filter(chair_type=Role.NOMCOM_CHAIR).order_by("start_year"):
group = Group()
group.acronym = "nomcom%s" % o.start_year
print "importing ChairsHistory/Nomcom", o.pk, "nomcom%s" % o.start_year
group, _ = Group.objects.get_or_create(acronym="nomcom%s" % o.start_year)
group.name = "IAB/IESG Nominating Committee %s/%s" % (o.start_year, o.end_year)
if o.chair_type.person == o.person:
s = state_names["active"]
@ -97,7 +97,14 @@ for o in ChairsHistory.objects.filter(chair_type=Role.NOMCOM_CHAIR).order_by("st
# Area
for o in Area.objects.all():
group, _ = Group.objects.get_or_create(acronym=o.area_acronym.acronym)
print "importing Area", o.pk, o.area_acronym.acronym
try:
group = Group.objects.get(acronym=o.area_acronym.acronym)
except Group.DoesNotExist:
group = Group(acronym=o.area_acronym.acronym)
group.id = o.area_acronym_id # transfer id
group.name = o.area_acronym.name
if o.status.status == "Active":
s = state_names["active"]
@ -127,6 +134,8 @@ for o in Area.objects.all():
# IRTF
for o in IRTF.objects.all():
print "importing IRTF", o.pk, o.acronym
try:
group = Group.objects.get(acronym=o.acronym.lower())
except Group.DoesNotExist:
@ -144,7 +153,9 @@ for o in IRTF.objects.all():
# FIXME: missing fields from old: meeting_scheduled
# IETFWG, AreaGroup
for o in IETFWG.objects.all():
for o in IETFWG.objects.all().order_by("pk"):
print "importing IETFWG", o.pk, o.group_acronym.acronym
try:
group = Group.objects.get(acronym=o.group_acronym.acronym)
except Group.DoesNotExist:
@ -198,6 +209,10 @@ for o in IETFWG.objects.all():
print "no area/parent for", group.acronym, group.name, group.type, group.state
group.list_email = o.email_address if o.email_address else ""
l = o.email_archive.strip() if o.email_archive else ""
if l in ("none", "not available"):
l = ""
group.list_pages = l
group.comments = o.comments.strip() if o.comments else ""
group.save()
@ -219,4 +234,4 @@ for o in IETFWG.objects.all():
import_date_event("concluded")
# dormant_date is empty on all so don't bother with that
# FIXME: missing fields from old: meeting_scheduled, email_subscribe, email_keyword, email_archive, last_modified_date, meeting_scheduled_old
# FIXME: missing fields from old: meeting_scheduled, email_subscribe, email_keyword, last_modified_date, meeting_scheduled_old