Hide regions with no attorneys in them
This commit is contained in:
parent
4c84c30285
commit
eaae3c346d
@ -1,30 +1,33 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load charter_members_extra %}
|
||||
|
||||
{% block body %}
|
||||
<div class="container-fluid bg-dark-primary py-3">
|
||||
<div class="container">
|
||||
{% for region in region %}
|
||||
<div class="row bg-white mb-5">
|
||||
<div class="col-12 pt-3">
|
||||
<h2 class="text-dark-primary">{{ region }}</h2>
|
||||
<hr style="border-top: 1px solid rgba(0,0,0,0.2) !important">
|
||||
<div class="row">
|
||||
{% for attorney in attorneys %}
|
||||
{% if attorney.region == region %}
|
||||
<a class="col-3 text-center pt-5" href="{% url 'attorney' attorney.id %}">
|
||||
<div>
|
||||
<img class="pb-3" src="/media/{{ attorney.image }}"
|
||||
style="width: auto; max-width: 100%; height: 200px"/>
|
||||
<h5 class="text-dark-primary">{{ attorney.first_name }} {{ attorney.last_name }}</h5>
|
||||
<span class="text-light-primary">{{ attorney.position }}</span>
|
||||
<hr>
|
||||
</div>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if attorneys|filter_region:region|length > 0 %}
|
||||
<div class="row bg-white mb-5">
|
||||
<div class="col-12 pt-3">
|
||||
<h2 class="text-dark-primary">{{ region }}</h2>
|
||||
<hr style="border-top: 1px solid rgba(0,0,0,0.2) !important">
|
||||
<div class="row">
|
||||
{% for attorney in attorneys %}
|
||||
{% if attorney.region == region %}
|
||||
<a class="col-3 text-center pt-5" href="{% url 'attorney' attorney.id %}">
|
||||
<div>
|
||||
<img class="pb-3" src="/media/{{ attorney.image }}"
|
||||
style="width: auto; max-width: 100%; height: 200px"/>
|
||||
<h5 class="text-dark-primary">{{ attorney.first_name }} {{ attorney.last_name }}</h5>
|
||||
<span class="text-light-primary">{{ attorney.position }}</span>
|
||||
<hr>
|
||||
</div>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if other %}
|
||||
<div class="row bg-white mb-5">
|
||||
|
0
charter_members/templatetags/__init__.py
Normal file
0
charter_members/templatetags/__init__.py
Normal file
9
charter_members/templatetags/charter_members_extra.py
Normal file
9
charter_members/templatetags/charter_members_extra.py
Normal file
@ -0,0 +1,9 @@
|
||||
from django import template
|
||||
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
@register.filter
|
||||
def filter_region(things, args):
|
||||
return things.filter(region=args)
|
Loading…
Reference in New Issue
Block a user