Anonymous avatar Anonymous committed 670fd3d

use |safe since mark safe seems to be ignored

Comments (0)

Files changed (6)

gaepuv/puv/poll/models.py

 from google.appengine.ext import db
 from django import forms
+from django.utils.safestring import mark_safe
 
 class Poll(db.Model):
     """ Top level poll 
         return '%s' % self.question
     
     def get_absolute_url(self):
-        return '/poll/%s/' % self.key()
+        return mark_safe('/poll/%s/' % self.key())
     
 class Choice(db.Model):
     """ Location choices """
             html += self.address
         if self.url:
             html += '</a>'
-        return html 
+        return mark_safe(html) 
 
 class DateChoice(db.Model):
     """ Date and/or Time choices - dateortime is

gaepuv/puv/poll/widgets.py

 from django import forms
 from puv.settings import DEFAULT_LAT, DEFAULT_LNG
+from django.utils.safestring import mark_safe
 
 class LocationWidget(forms.TextInput):
     def __init__(self, *args, **kw):
                 a, b = DEFAULT_LAT, DEFAULT_LNG
             lat, lng = float(a), float(b)
 
-        return self.inner_widget.render(name, "%f,%f" % (lat, lng), 
-                                           dict(id='id_%s' % name))
+        return mark_safe(self.inner_widget.render(name, "%f,%f" % (lat, lng), 
+                                                  dict(id='id_%s' % name)))
         
 class LocationFormField(forms.CharField):
     widget = LocationWidget

gaepuv/puv/templates/create.html

 <link href="/media/jquery.datepick.css" type="text/css" rel="stylesheet" />
 
 {% for js in genjs %}
-{{ js }}
+{{ js|safe }}
 {% endfor %}
 {% endblock %}
 

gaepuv/puv/templates/poll_details.html

 
 {% block media %}
 {% for js in genjs %}
-{{ js }}
+{{ js|safe }}
 {% endfor %}
 {% endblock %}
 
 {% else %}
 {% for choice in choices %}
 <br /><img src="/media/marker/green{{ forloop.counter }}.png" alt="{{ forloop.counter }}. " /> <input type="{{ input_type }}" name="location" value="{{ choice.key }}" />
-{{ choice }}
+{{ choice|safe }}
 </li>
 {% endfor %}
 {% endif %}

gaepuv/puv/templates/poll_results.html

 </tr>
 {% for choice in choices %}
   <tr class="{% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}" id="id_location_{{ forloop.counter }}">
-<td>{{choice.votes}}</td><td>{{choice}}</td>
+<td>{{choice.votes}}</td><td>{{ choice|safe }}</td>
 {% if not poll.anonymous %}
 <td>{% for voter in choice.voter_set %}{{ voter.created_by }}{% if not forloop.last %}, {% endif %}{% endfor %}
 </td> 

gaepuv/puv/templates/vote_index.html

 
 <ol>
 {% for poll in polls %}
-<li><a href="{{poll.get_absolute_url}}">{{poll.question}}</a>
+<li><a href="{{ poll.get_absolute_url }}">{{poll.question}}</a>
 <span class="markerinfo">created on {{poll.created_on|date}}</span>
 </li>
 {% endfor %}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.