diff --git a/api/urls.py b/api/urls.py index 1f3b57d..b7e94d0 100644 --- a/api/urls.py +++ b/api/urls.py @@ -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()), diff --git a/api/views/hacker/get/csv/__init__.py b/api/views/hacker/get/csv/__init__.py index c5621a7..74db323 100644 --- a/api/views/hacker/get/csv/__init__.py +++ b/api/views/hacker/get/csv/__init__.py @@ -1 +1,2 @@ -from .by_school import BySchoolCsv \ No newline at end of file +from .by_school import BySchoolCsv +from .resume_links import ResumeLinksCsv diff --git a/api/views/hacker/get/csv/resume_links.py b/api/views/hacker/get/csv/resume_links.py new file mode 100644 index 0000000..dbe85c8 --- /dev/null +++ b/api/views/hacker/get/csv/resume_links.py @@ -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 diff --git a/webapp/views/organize/index/index.pug b/webapp/views/organize/index/index.pug index 908eaca..7b031c9 100644 --- a/webapp/views/organize/index/index.pug +++ b/webapp/views/organize/index/index.pug @@ -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 \ No newline at end of file + 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 \ No newline at end of file