Created a members page

This commit is contained in:
Zakary Timson 2018-01-14 17:55:35 -05:00
parent 22afbca227
commit 1c1b56722c
6 changed files with 51 additions and 7 deletions

View File

@ -37,6 +37,7 @@ urlpatterns = [
url(r'^logout/', main.views.logout, name='logout'),
url(r'^media/secure/(?P<path>.*)$', protected_serve, {'document_root': os.path.join(settings.MEDIA_ROOT, 'secure')}, name='secure media'),
url(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}, name='media'),
url(r'^members', charter_members.views.all, name='members'),
url(r'^newsletter/unsubscribe', newsletters.views.unsubscribe, name='unsubscribe'),
url(r'^newsletter/', newsletters.views.newsletters, name='newsletters'),
url(r'^tinymce/', include('tinymce.urls'))

View File

@ -0,0 +1,31 @@
{% extends 'base.html' %}
{% block body %}
<div class="container-fluid bg-dark-primary py-3">
<div class="container">
{% for chapter in chapters %}
<div class="row bg-white mb-5">
<div class="col-12 pt-3">
<h2 class="text-dark-primary">{{ chapter }}</h2>
<hr style="border-top: 1px solid rgba(0,0,0,0.2) !important">
<div class="row">
{% for attorney in attorneys %}
{% if attorney.chapter == chapter %}
<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.name }}</h5>
<span class="text-light-primary">{{ attorney.position }}</span>
<hr>
</div>
</a>
{% endif %}
{% endfor %}
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% endblock %}

View File

@ -1,8 +1,15 @@
from django.db.models import Count
from django.shortcuts import render
from .models import Attorney
from .models import Chapter, Attorney
def index(request, id):
attorney = Attorney.objects.get(id=id)
return render(request, 'attorney.html', {'attorney': attorney})
def all(request):
chapters = Chapter.objects.all().order_by('name')
attorneys = Attorney.objects.all().annotate(Count('chapter'))
return render(request, 'all.html', {'chapters': chapters, 'attorneys': attorneys})

View File

@ -143,6 +143,9 @@
</a>
{% endfor %}
</div>
<div class="col-12 mt-3 text-center">
<a class="text-dark-primary" href="{% url 'members' %}">View All</a>
</div>
</div>
</div>
{% endif %}

View File

@ -22,7 +22,7 @@ body {
}
hr {
border-top: 1px solid #377DBD !important;
border-top: 1px solid #377DBD;
}
ul {

View File

@ -42,11 +42,13 @@
</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<li class="nav-item text-dark-primary">
<a class="nav-link" href="{% url 'home' %}">HOME</a>
</li>
<li class="new-item text-dark-primary">
<a class="nav-link" href="{% url 'newsletters' %}">NEWSLETTERS</a>
<li class="nav-item dropdown text-dark-primary">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">HOME</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{% url 'home' %}">Front Page</a>
<a class="dropdown-item" href="{% url 'newsletters' %}">Newsletters</a>
<a class="dropdown-item" href="{% url 'members' %}">Members</a>
</div>
</li>
<li class="nav-item text-dark-primary">
<a class="nav-link" href="{% url 'forum' %}">FORUM</a>