diff --git a/charter_members/templates/all.html b/charter_members/templates/all.html index 15b0814..3f4ff8f 100644 --- a/charter_members/templates/all.html +++ b/charter_members/templates/all.html @@ -1,30 +1,33 @@ {% extends 'base.html' %} +{% load charter_members_extra %} {% block body %}
{% for region in region %} -
-
-

{{ region }}

-
-
- {% for attorney in attorneys %} - {% if attorney.region == region %} - -
- -
{{ attorney.first_name }} {{ attorney.last_name }}
- {{ attorney.position }} -
-
-
- {% endif %} - {% endfor %} + {% if attorneys|filter_region:region|length > 0 %} +
+
+

{{ region }}

+
+
+ {% for attorney in attorneys %} + {% if attorney.region == region %} + +
+ +
{{ attorney.first_name }} {{ attorney.last_name }}
+ {{ attorney.position }} +
+
+
+ {% endif %} + {% endfor %} +
-
+ {% endif %} {% endfor %} {% if other %}
diff --git a/charter_members/templatetags/__init__.py b/charter_members/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/charter_members/templatetags/charter_members_extra.py b/charter_members/templatetags/charter_members_extra.py new file mode 100644 index 0000000..959e239 --- /dev/null +++ b/charter_members/templatetags/charter_members_extra.py @@ -0,0 +1,9 @@ +from django import template + + +register = template.Library() + + +@register.filter +def filter_region(things, args): + return things.filter(region=args)