Skip to content
Snippets Groups Projects
Commit d7f07bdf authored by Ben Adida's avatar Ben Adida
Browse files

added ability to include safe HTML in the election description

parent dbd0886a
Branches
Tags
No related merge requests found
......@@ -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')
......
{% 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 %}
......
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment