diff --git a/expert_witnesses/templates/expertBrowser.html b/expert_witnesses/templates/expertBrowser.html index bdcc0e0..403d3f8 100644 --- a/expert_witnesses/templates/expertBrowser.html +++ b/expert_witnesses/templates/expertBrowser.html @@ -4,6 +4,34 @@
+
+

Filters:

+
+
+
Name
+ +
+
+
Institute
+ +
+
+
Areas of Expertise
+ +
+ +
+
{% for expert in experts %} @@ -23,34 +51,6 @@ {% endfor %}
-
-

Filters:

-
-
-
Name
- -
-
-
Institute
- -
-
-
Areas of Expertise
- -
- -
-
diff --git a/expert_witnesses/views.py b/expert_witnesses/views.py index 355807d..d3fef3e 100644 --- a/expert_witnesses/views.py +++ b/expert_witnesses/views.py @@ -4,7 +4,7 @@ from .models import AreaOfExpertise, Expert def browser(request): - filters = AreaOfExpertise.objects.all().order_by('field') + aoe = AreaOfExpertise.objects.all().order_by('field') experts = Expert.objects.all() @@ -12,16 +12,20 @@ def browser(request): for expert in experts: institutes.add(expert.institute) if expert.institute is not None else None - if request.GET.get('name'): + name = request.GET.get('name') + institute = request.GET.get('institute') + expertise = request.GET.get('expertise') + + if name: experts = experts.filter(name__contains=request.GET.get('name')) - if request.GET.get('institute'): + if institute: experts = experts.filter(institute=request.GET.get('institute')) - if request.GET.get('experties'): - experts = experts.filter(expertise=AreaOfExpertise.objects.filter(field=request.GET.get('experties'))).distinct() + if expertise: + experts = experts.filter(expertise=AreaOfExpertise.objects.filter(field=expertise)).distinct() - return render(request, 'expertBrowser.html', {'experts': experts, 'institutes': institutes, 'filters': filters}) + return render(request, 'expertBrowser.html', {'experts': experts, 'institutes': institutes, 'aoe': aoe, 'name': name, 'institute': institute, 'expertise': expertise}) def viewer(request, id):