oacpl/expert_witnesses/views.py

19 lines
581 B
Python
Raw Normal View History

2017-09-05 02:24:39 -04:00
from django.shortcuts import render
2017-09-14 13:52:39 -04:00
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})