diff --git a/helios/models.py b/helios/models.py index 869f1fa00196007e537c0b68ecc5ddae43484f11..bb516a9c299e1a8d0748b8e69f64ed94ab3f9f10 100644 --- a/helios/models.py +++ b/helios/models.py @@ -12,6 +12,7 @@ from django.conf import settings from django.core.mail import send_mail import datetime, logging, uuid, random, io +import bleach from crypto import electionalgs, algs, utils from helios import utils as heliosutils @@ -189,6 +190,10 @@ class Election(HeliosModel): def is_archived(self): return self.archived_at != None + @property + def description_bleached(self): + return bleach.clean(self.description) + @classmethod def get_featured(cls): return cls.objects.filter(featured_p = True).order_by('short_name') diff --git a/helios/templates/election_view.html b/helios/templates/election_view.html index e486ddb76dba212382e8f3a3cf07cbd98b1b0336..92c6b2e6a9d3492373fac2e19de51e9495ca1464 100644 --- a/helios/templates/election_view.html +++ b/helios/templates/election_view.html @@ -1,5 +1,4 @@ {% extends TEMPLATE_BASE %} - {% block title %}{{election.name}}{% endblock %} {% block content %} <div style="float: left; margin-right: 50px;"> @@ -47,7 +46,7 @@ this {{election.election_type}} is <u>not</u> featured on the front page. <br clear="left" /> <div style="margin-bottom: 25px;margin-left: 15px; border-left: 1px solid #aaa; padding-left: 5px; font-size:1.3em; "> -{{election.description}} +{{election.description_bleached|safe}} </div> {% if election.election_info_url %} diff --git a/requirements.txt b/requirements.txt index 49dcfd0fcdb4f34fd6b077d8fcf4a56fe5107a40..02d47dce17742e18525077a724628defc36283f3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,3 +19,4 @@ django_webtest==1.7.5 webtest==2.0.7 django-db-pool==0.0.10 django-secure==0.1.2 +bleach==1.4