Skip to content

Commit

Permalink
Added comma delimiting template filter and applied it to project_deta…
Browse files Browse the repository at this point in the history
…il template countries (#164)
  • Loading branch information
pwhipp committed Sep 22, 2014
1 parent a6d013a commit 5362131
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions projects/templates/projects/project_detail.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% load mkdown_filters %}
{% load mkdown_filters projects_tags %}
{% block main %}
<h1>{{ project.name }}</h1>
{% if can_update %}
Expand Down Expand Up @@ -39,7 +39,7 @@ <h2>Project Details</h2>
</tr>
<tr>
<th width="30%">Country</th>
<td>{{ project.countries }}</td>
<td>{{ project.countries.all|join }}</td>
</tr>
<tr>
<th width="30%">Locality</th>
Expand Down
Empty file.
11 changes: 11 additions & 0 deletions projects/templatetags/projects_tags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django import template

register = template.Library()


def joinby(value, delim=', '):
string_values = [u'{0}'.format(v) for v in value]
return delim.join(string_values)

register.filter('join', joinby)

0 comments on commit 5362131

Please sign in to comment.