Use wg_www_pages table for area/group specific URLs

- Legacy-Id: 2034
This commit is contained in:
Pasi Eronen 2010-03-01 18:41:30 +00:00
parent 97de36a0e6
commit bf4c92756e
6 changed files with 48 additions and 10 deletions

View file

@ -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:

View file

@ -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

View file

@ -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'

View file

@ -57,6 +57,17 @@ Working Groups</a> and
{% endif %}
{% endfor %}
{% for url in area.additional_urls %}
{% if forloop.first %}
<p>Area Specific Web Page{{ forloop.revcounter|pluralize}}:</p>
<p style="margin-left: 2em">
{% endif %}
<a href="{{url.url}}">{{ url.description }}</a>{% if not forloop.last %}<br/>{% endif %}
{% if forloop.last %}
</p>
{% endif %}
{% endfor %}
{% for wg in area.active_wgs %}
{% if forloop.first %}
<p>Active Working Groups:</p>

View file

@ -108,6 +108,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</table>
</div>
{% if wg.additional_urls %}
<p>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 %}
<a href="{{ url.url }}">{{ url.description}}</a>{% if not forloop.last %}, {% endif %}
{% endfor %}
</p>
{% endif %}
<h2>Description of Working Group</h2>
<p>{{ wg.charter_text|escape|format_charter|safe }}</p>

View file

@ -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;