Skip to content

Commit

Permalink
hacker resume csv link
Browse files Browse the repository at this point in the history
  • Loading branch information
jrdbnntt committed Feb 24, 2017
1 parent cd2d474 commit c3900a5
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 2 deletions.
1 change: 1 addition & 0 deletions api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
url(r'hacker/register$', views.hacker.RegisterView.as_view(), name='hacker-register'),
url(r'hacker/get/profile$', views.hacker.get.ProfileView.as_view(), name='hacker-get-profile'),
url(r'hacker/get/csv/by_school', views.hacker.get.csv.BySchoolCsv.as_view()),
url(r'hacker/get/csv/resume_links', views.hacker.get.csv.ResumeLinksCsv.as_view()),

url(r'judge/register$', views.judge.RegisterView.as_view(), name='judge-register'),
url(r'judge/assign_hacks$', views.judge.AssignHacksView.as_view()),
Expand Down
3 changes: 2 additions & 1 deletion api/views/hacker/get/csv/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from .by_school import BySchoolCsv
from .by_school import BySchoolCsv
from .resume_links import ResumeLinksCsv
47 changes: 47 additions & 0 deletions api/views/hacker/get/csv/resume_links.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
"""
Generates a CSV containing approved hackers' resumes
"""

from hackfsu_com.views.generic import StreamedCsvView
from hackfsu_com.util import acl, files
from django.conf import settings
from api.models import Hackathon, HackerInfo


class ResumeLinksCsv(StreamedCsvView):
access_manager = acl.AccessManager(acl_accept=[acl.group_organizer])
file_name = 'HackFSU Approved Hackers\' Submitted Resumes.csv'

@staticmethod
def row_generator(request):
h = Hackathon.objects.current()
yield ['Approved Hackers\' Submitted Resumes']
yield [
'First Name',
'Last Name',
'Email',
'School',
'Attended',
'Resume File Name',
'Resume URL'
]

for hacker in HackerInfo.objects.filter(
hackathon=h,
approved=True
):
row = [
hacker.user.first_name,
hacker.user.last_name,
hacker.user.email,
str(hacker.school),
hacker.attendee_status.checked_in_at is not None
]

if len(hacker.resume_file_name) > 0:
row.extend([
hacker.resume_file_name.split('/')[-1],
settings.URL_BASE + files.get_url(hacker.resume_file_name)
])

yield row
3 changes: 2 additions & 1 deletion webapp/views/organize/index/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ block content
li: a(href="/api/hacker/get/csv/by_school" target="_blank" download) Hacker data and school names
li: a(href="/api/organizer/get/csv/roster" target="_blank" download) Organizer Roster
li: a(href="/api/hackathon/get/csv/attendees_checked_in" target="_blank" download) Checked in attendees
li: a(href="/api/judge/get/csv/hacks_with_manual_criteria" target="_blank" download) Hacks for manual judging
li: a(href="/api/judge/get/csv/hacks_with_manual_criteria" target="_blank" download) Hacks for manual judging
li: a(href="/api/hacker/get/csv/resume_links" target="_blank" download) Approved hacker data with resume links

0 comments on commit c3900a5

Please sign in to comment.