Hide regions with no attorneys in them

This commit is contained in:
Zakary Timson 2018-02-26 23:15:16 -05:00
parent 4c84c30285
commit eaae3c346d
3 changed files with 31 additions and 19 deletions

View File

@ -1,9 +1,11 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% load charter_members_extra %}
{% block body %} {% block body %}
<div class="container-fluid bg-dark-primary py-3"> <div class="container-fluid bg-dark-primary py-3">
<div class="container"> <div class="container">
{% for region in region %} {% for region in region %}
{% if attorneys|filter_region:region|length > 0 %}
<div class="row bg-white mb-5"> <div class="row bg-white mb-5">
<div class="col-12 pt-3"> <div class="col-12 pt-3">
<h2 class="text-dark-primary">{{ region }}</h2> <h2 class="text-dark-primary">{{ region }}</h2>
@ -25,6 +27,7 @@
</div> </div>
</div> </div>
</div> </div>
{% endif %}
{% endfor %} {% endfor %}
{% if other %} {% if other %}
<div class="row bg-white mb-5"> <div class="row bg-white mb-5">

View File

View File

@ -0,0 +1,9 @@
from django import template
register = template.Library()
@register.filter
def filter_region(things, args):
return things.filter(region=args)