Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Issue #33: Add search by major feature to the resume list page #44

Merged
merged 1 commit into from

1 participant

@rogerskw
Owner

No description provided.

@rogerskw rogerskw merged commit 31169fa into v1.0.0
@rogerskw rogerskw deleted the iss33 branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
BIN  db.sqlite3
Binary file not shown
View
4 info/templates/resume_list.html
@@ -17,12 +17,12 @@ <h1 class="page-header">Resumes</h1>
<form method='GET' name='submit'>
<div class='row'>
-<!-- <div class='col-sm-2'>
+ <div class='col-sm-2'>
Majors: <br />
{% for major in majors %}
<input type='checkbox' name='major' value='{{ major.majorName }}'>{{ major.majorName }}<br />
{% endfor %}
- </div> -->
+ </div>
<div class='col-sm-2'>
Graduation Years: <br />
{% for year in years %}
View
10 info/views.py
@@ -87,10 +87,14 @@ def resumes(request):
for i in xrange(5):
years.append(year+i)
grad_year_requests = request.GET.getlist('gradyear')
- reqs = Q()
+ major_requests = request.GET.getlist('major')
+ grad_year_reqs = Q()
for grad_year_request in grad_year_requests:
- reqs = reqs | Q(graduationYear=int(grad_year_request))
- brothers = Brother.objects.filter(reqs).order_by('lastName', 'firstName', 'middleName')
+ grad_year_reqs = grad_year_reqs | Q(graduationYear=int(grad_year_request))
+ major_reqs = Q()
+ for major_request in major_requests:
+ major_reqs = major_reqs | Q(majors__majorName=major_request)
+ brothers = Brother.objects.filter(major_reqs, grad_year_reqs).order_by('lastName', 'firstName', 'middleName')
majors = Major.objects.all().order_by('majorName')
c = Context({'brothers': brothers, 'majors': majors, 'years': years})
t = loader.get_template('resume_list.html')
Something went wrong with that request. Please try again.