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,30 +1,33 @@
{% 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 %}
<div class="row bg-white mb-5"> {% if attorneys|filter_region:region|length > 0 %}
<div class="col-12 pt-3"> <div class="row bg-white mb-5">
<h2 class="text-dark-primary">{{ region }}</h2> <div class="col-12 pt-3">
<hr style="border-top: 1px solid rgba(0,0,0,0.2) !important"> <h2 class="text-dark-primary">{{ region }}</h2>
<div class="row"> <hr style="border-top: 1px solid rgba(0,0,0,0.2) !important">
{% for attorney in attorneys %} <div class="row">
{% if attorney.region == region %} {% for attorney in attorneys %}
<a class="col-3 text-center pt-5" href="{% url 'attorney' attorney.id %}"> {% if attorney.region == region %}
<div> <a class="col-3 text-center pt-5" href="{% url 'attorney' attorney.id %}">
<img class="pb-3" src="/media/{{ attorney.image }}" <div>
style="width: auto; max-width: 100%; height: 200px"/> <img class="pb-3" src="/media/{{ attorney.image }}"
<h5 class="text-dark-primary">{{ attorney.first_name }} {{ attorney.last_name }}</h5> style="width: auto; max-width: 100%; height: 200px"/>
<span class="text-light-primary">{{ attorney.position }}</span> <h5 class="text-dark-primary">{{ attorney.first_name }} {{ attorney.last_name }}</h5>
<hr> <span class="text-light-primary">{{ attorney.position }}</span>
</div> <hr>
</a> </div>
{% endif %} </a>
{% endfor %} {% endif %}
{% endfor %}
</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)