From bf4c92756eb3b8812ece00abe2812e7af0f183a7 Mon Sep 17 00:00:00 2001 From: Pasi Eronen Date: Mon, 1 Mar 2010 18:41:30 +0000 Subject: [PATCH] Use wg_www_pages table for area/group specific URLs - Legacy-Id: 2034 --- changelog | 10 ++++++++++ ietf/idtracker/admin.py | 4 ++-- ietf/idtracker/models.py | 24 ++++++++++++++++-------- ietf/templates/wginfo/wg-dir.html | 11 +++++++++++ ietf/templates/wginfo/wg_charter.html | 8 ++++++++ test/sql_fixup.sql | 1 + 6 files changed, 48 insertions(+), 10 deletions(-) diff --git a/changelog b/changelog index 17ae3a0ee..ea74b26eb 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,13 @@ +ietfdb (2.45) + + From Pasi: + + * Use wg_www_pages table (and removed unused idtracker_areaurl). + Requires applying changes to database as follows: + + cd /a/www/ietf-datatracker/2.45/ietf + PYTHONPATH=../ python manage.py dbshell < ../test/sql_fixup.sql + ietfdb (2.44) From Robert: diff --git a/ietf/idtracker/admin.py b/ietf/idtracker/admin.py index 5464cfc43..baf83a435 100644 --- a/ietf/idtracker/admin.py +++ b/ietf/idtracker/admin.py @@ -18,9 +18,9 @@ class AreaStatusAdmin(admin.ModelAdmin): pass admin.site.register(AreaStatus, AreaStatusAdmin) -class AreaURLAdmin(admin.ModelAdmin): +class AreaWGURLAdmin(admin.ModelAdmin): pass -admin.site.register(AreaURL, AreaURLAdmin) +admin.site.register(AreaWGURL, AreaWGURLAdmin) class BallotInfoAdmin(admin.ModelAdmin): pass diff --git a/ietf/idtracker/models.py b/ietf/idtracker/models.py index a10fe9c5a..6ca07f9c6 100644 --- a/ietf/idtracker/models.py +++ b/ietf/idtracker/models.py @@ -85,6 +85,8 @@ class Area(models.Model): extra_email_addresses = models.TextField(blank=True) def __str__(self): return self.area_acronym.acronym + def additional_urls(self): + return AreaWGURL.objects.filter(name=self.area_acronym.name) def active_wgs(self): return IETFWG.objects.filter(group_type=1,status=IETFWG.ACTIVE,areagroup__area=self).order_by('group_acronym__acronym') def active_areas(): @@ -97,14 +99,17 @@ class Area(models.Model): list_display = ('area_acronym', 'status') pass -class AreaURL(models.Model): - area = models.ForeignKey(Area, null=True, related_name='urls') - url = models.URLField(max_length=255, db_column='url_value') - url_label = models.CharField(max_length=255, db_column='url_label') - def __str__(self): - return self.url - class Admin: - pass +class AreaWGURL(models.Model): + id = models.AutoField(primary_key=True, db_column='area_ID') + # For WGs, this is the WG acronym; for areas, it's the area name. + name = models.CharField(max_length=50, db_column='area_Name') + url = models.CharField(max_length=50) + description = models.CharField(max_length=50) + def __unicode__(self): + return u'%s (%s)' % (self.name, self.description) + class Meta: + ordering = ['name'] + db_table = "wg_www_pages" class IDStatus(models.Model): status_id = models.AutoField(primary_key=True) @@ -930,6 +935,9 @@ class IETFWG(models.Model): except BaseException: desc = 'Error Loading Work Group Description' return desc + + def additional_urls(self): + return AreaWGURL.objects.filter(name=self.group_acronym.acronym) class Meta: db_table = 'groups_ietf' diff --git a/ietf/templates/wginfo/wg-dir.html b/ietf/templates/wginfo/wg-dir.html index 68214f954..426d5dd2a 100644 --- a/ietf/templates/wginfo/wg-dir.html +++ b/ietf/templates/wginfo/wg-dir.html @@ -57,6 +57,17 @@ Working Groups and {% endif %} {% endfor %} +{% for url in area.additional_urls %} +{% if forloop.first %} +

Area Specific Web Page{{ forloop.revcounter|pluralize}}:

+

+{% endif %} +{{ url.description }}{% if not forloop.last %}
{% endif %} +{% if forloop.last %} +

+{% endif %} +{% endfor %} + {% for wg in area.active_wgs %} {% if forloop.first %}

Active Working Groups:

diff --git a/ietf/templates/wginfo/wg_charter.html b/ietf/templates/wginfo/wg_charter.html index abf50623e..f138ba09e 100644 --- a/ietf/templates/wginfo/wg_charter.html +++ b/ietf/templates/wginfo/wg_charter.html @@ -108,6 +108,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +{% if wg.additional_urls %} +

In addition to the charter maintained by the IETF Secretariat, there is additional information about this working group on the Web at: +{% for url in wg.additional_urls %} +{{ url.description}}{% if not forloop.last %}, {% endif %} +{% endfor %} +

+{% endif %} +

Description of Working Group

{{ wg.charter_text|escape|format_charter|safe }}

diff --git a/test/sql_fixup.sql b/test/sql_fixup.sql index ef90b8e85..20fc4c8ec 100644 --- a/test/sql_fixup.sql +++ b/test/sql_fixup.sql @@ -1,2 +1,3 @@ -- This file holds needed corrections to the database until they have been applied to -- the live database. This file is applied after importing a new dump of the live DB. +DROP TABLE idtracker_areaurl;