oacpl/expert_witnesses/views.py
2017-09-14 13:52:39 -04:00

19 lines
581 B
Python

from django.shortcuts import render
from .models import AreaOfExpertise, Expert
def browser(request):
filters = AreaOfExpertise.objects.all().order_by('field')
filter = filters.filter(field=request.POST.get('filter')).values_list('field')
experts = Expert.objects.all()
if filter:
experts = experts.filter(expertise__in=filter)
return render(request, 'expertBrowser.html', {'experts': experts, 'filters': filters})
def viewer(request, id):
expert = Expert.objects.get(id=id)
return render(request, 'expertViewer.html', {'expert': expert})