From a6f22b2a038dca23ed3cc2ff39ff2f297d0e8acd Mon Sep 17 00:00:00 2001 From: Zak Timson Date: Thu, 25 Jan 2018 00:52:57 -0500 Subject: [PATCH] Show members not in a region on the all page --- charter_members/templates/all.html | 21 +++++++++++++++++++++ charter_members/views.py | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/charter_members/templates/all.html b/charter_members/templates/all.html index b335ef9..15b0814 100644 --- a/charter_members/templates/all.html +++ b/charter_members/templates/all.html @@ -26,6 +26,27 @@ {% endfor %} + {% if other %} +
+
+
+ {% for attorney in attorneys %} + {% if not attorney.region %} + +
+ +
{{ attorney.first_name }} {{ attorney.last_name }}
+ {{ attorney.position }} +
+
+
+ {% endif %} + {% endfor %} +
+
+
+ {% endif %} {% endblock %} diff --git a/charter_members/views.py b/charter_members/views.py index 83be897..891d90a 100644 --- a/charter_members/views.py +++ b/charter_members/views.py @@ -12,4 +12,5 @@ def index(request, id): def all(request): region = Region.objects.all().order_by('name') attorneys = Attorney.objects.all().annotate(Count('region')) - return render(request, 'all.html', {'region': region, 'attorneys': attorneys}) + other = Attorney.objects.filter(region=None).count() > 0 + return render(request, 'all.html', {'region': region, 'attorneys': attorneys, 'other': other})