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
No related branches found
No related tags found
No related merge requests found
...@@ -12,6 +12,7 @@ from django.conf import settings ...@@ -12,6 +12,7 @@ from django.conf import settings
from django.core.mail import send_mail from django.core.mail import send_mail
import datetime, logging, uuid, random, io import datetime, logging, uuid, random, io
import bleach
from crypto import electionalgs, algs, utils from crypto import electionalgs, algs, utils
from helios import utils as heliosutils from helios import utils as heliosutils
...@@ -189,6 +190,10 @@ class Election(HeliosModel): ...@@ -189,6 +190,10 @@ class Election(HeliosModel):
def is_archived(self): def is_archived(self):
return self.archived_at != None return self.archived_at != None
@property
def description_bleached(self):
return bleach.clean(self.description)
@classmethod @classmethod
def get_featured(cls): def get_featured(cls):
return cls.objects.filter(featured_p = True).order_by('short_name') return cls.objects.filter(featured_p = True).order_by('short_name')
......
{% extends TEMPLATE_BASE %} {% extends TEMPLATE_BASE %}
{% block title %}{{election.name}}{% endblock %} {% block title %}{{election.name}}{% endblock %}
{% block content %} {% block content %}
<div style="float: left; margin-right: 50px;"> <div style="float: left; margin-right: 50px;">
...@@ -47,7 +46,7 @@ this {{election.election_type}} is <u>not</u> featured on the front page. ...@@ -47,7 +46,7 @@ this {{election.election_type}} is <u>not</u> featured on the front page.
<br clear="left" /> <br clear="left" />
<div style="margin-bottom: 25px;margin-left: 15px; border-left: 1px solid #aaa; padding-left: 5px; font-size:1.3em; "> <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> </div>
{% if election.election_info_url %} {% if election.election_info_url %}
......
...@@ -19,3 +19,4 @@ django_webtest==1.7.5 ...@@ -19,3 +19,4 @@ django_webtest==1.7.5
webtest==2.0.7 webtest==2.0.7
django-db-pool==0.0.10 django-db-pool==0.0.10
django-secure==0.1.2 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