Added generic list template column option to make data non-breakable

This commit is contained in:
Roberto Rosario
2011-03-07 19:21:02 -04:00
parent bcbf0785be
commit af9b21c1d0
2 changed files with 16 additions and 1 deletions

View File

@@ -2,6 +2,7 @@
{% load attribute_tags %}
{% load pagination_tags %}
{% load navigation %}
{% load non_breakable %}
{% if side_bar %}
<div class="block">
@@ -60,7 +61,13 @@
{% endfor %}
{% endif %}
{% for column in extra_columns %}
<td>{{ object|object_property:column.attribute|safe }}</td>
{% if column.keep_together %}
<div class="nowrap" style="word-wrap: normal">
<td>{{ object|object_property:column.attribute|safe|make_non_breakable }}</td>
</div>
{% else %}
<td>{{ object|object_property:column.attribute|safe }}</td>
{% endif %}
{% endfor %}
{% if not hide_links %}
<td class="last">

View File

@@ -0,0 +1,8 @@
from django.template import Library
register = Library()
@register.filter
def make_non_breakable(value):
return value.replace(u'-', u'\u2011')