Skip to content

Commit bf4c927

Browse files
committed
Use wg_www_pages table for area/group specific URLs
- Legacy-Id: 2034
1 parent 97de36a commit bf4c927

6 files changed

Lines changed: 48 additions & 10 deletions

File tree

changelog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
ietfdb (2.45)
2+
3+
From Pasi:
4+
5+
* Use wg_www_pages table (and removed unused idtracker_areaurl).
6+
Requires applying changes to database as follows:
7+
8+
cd /a/www/ietf-datatracker/2.45/ietf
9+
PYTHONPATH=../ python manage.py dbshell < ../test/sql_fixup.sql
10+
111
ietfdb (2.44)
212

313
From Robert:

ietf/idtracker/admin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ class AreaStatusAdmin(admin.ModelAdmin):
1818
pass
1919
admin.site.register(AreaStatus, AreaStatusAdmin)
2020

21-
class AreaURLAdmin(admin.ModelAdmin):
21+
class AreaWGURLAdmin(admin.ModelAdmin):
2222
pass
23-
admin.site.register(AreaURL, AreaURLAdmin)
23+
admin.site.register(AreaWGURL, AreaWGURLAdmin)
2424

2525
class BallotInfoAdmin(admin.ModelAdmin):
2626
pass

ietf/idtracker/models.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ class Area(models.Model):
8585
extra_email_addresses = models.TextField(blank=True)
8686
def __str__(self):
8787
return self.area_acronym.acronym
88+
def additional_urls(self):
89+
return AreaWGURL.objects.filter(name=self.area_acronym.name)
8890
def active_wgs(self):
8991
return IETFWG.objects.filter(group_type=1,status=IETFWG.ACTIVE,areagroup__area=self).order_by('group_acronym__acronym')
9092
def active_areas():
@@ -97,14 +99,17 @@ class Admin:
9799
list_display = ('area_acronym', 'status')
98100
pass
99101

100-
class AreaURL(models.Model):
101-
area = models.ForeignKey(Area, null=True, related_name='urls')
102-
url = models.URLField(max_length=255, db_column='url_value')
103-
url_label = models.CharField(max_length=255, db_column='url_label')
104-
def __str__(self):
105-
return self.url
106-
class Admin:
107-
pass
102+
class AreaWGURL(models.Model):
103+
id = models.AutoField(primary_key=True, db_column='area_ID')
104+
# For WGs, this is the WG acronym; for areas, it's the area name.
105+
name = models.CharField(max_length=50, db_column='area_Name')
106+
url = models.CharField(max_length=50)
107+
description = models.CharField(max_length=50)
108+
def __unicode__(self):
109+
return u'%s (%s)' % (self.name, self.description)
110+
class Meta:
111+
ordering = ['name']
112+
db_table = "wg_www_pages"
108113

109114
class IDStatus(models.Model):
110115
status_id = models.AutoField(primary_key=True)
@@ -930,6 +935,9 @@ def charter_text(self): # return string containing WG description read from file
930935
except BaseException:
931936
desc = 'Error Loading Work Group Description'
932937
return desc
938+
939+
def additional_urls(self):
940+
return AreaWGURL.objects.filter(name=self.group_acronym.acronym)
933941

934942
class Meta:
935943
db_table = 'groups_ietf'

ietf/templates/wginfo/wg-dir.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@ <h2 class="ietf-divider" id="{{area.area_acronym.name|cut:" "}}">{{ area.area_ac
5757
{% endif %}
5858
{% endfor %}
5959

60+
{% for url in area.additional_urls %}
61+
{% if forloop.first %}
62+
<p>Area Specific Web Page{{ forloop.revcounter|pluralize}}:</p>
63+
<p style="margin-left: 2em">
64+
{% endif %}
65+
<a href="{{url.url}}">{{ url.description }}</a>{% if not forloop.last %}<br/>{% endif %}
66+
{% if forloop.last %}
67+
</p>
68+
{% endif %}
69+
{% endfor %}
70+
6071
{% for wg in area.active_wgs %}
6172
{% if forloop.first %}
6273
<p>Active Working Groups:</p>

ietf/templates/wginfo/wg_charter.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@
108108
</table>
109109
</div>
110110

111+
{% if wg.additional_urls %}
112+
<p>In addition to the charter maintained by the IETF Secretariat, there is additional information about this working group on the Web at:
113+
{% for url in wg.additional_urls %}
114+
<a href="{{ url.url }}">{{ url.description}}</a>{% if not forloop.last %}, {% endif %}
115+
{% endfor %}
116+
</p>
117+
{% endif %}
118+
111119
<h2>Description of Working Group</h2>
112120
<p>{{ wg.charter_text|escape|format_charter|safe }}</p>
113121

test/sql_fixup.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
-- This file holds needed corrections to the database until they have been applied to
22
-- the live database. This file is applied after importing a new dump of the live DB.
3+
DROP TABLE idtracker_areaurl;

0 commit comments

Comments
 (0)