def employer_resume_book_toggle_student(request): if not request.POST.has_key("student_id"): raise Http400("Request POST is missing the student_id.") student = Student.objects.get(id=request.POST["student_id"]) try: resume_book = ResumeBook.objects.get(recruiter=request.user.recruiter, delivered=False) except ResumeBook.DoesNotExist: resume_book = ResumeBook.objects.create(recruiter=request.user.recruiter) data = {} if student in resume_book.students.visible(): resume_book.students.remove(student) data["action"] = employer_enums.REMOVED else: employer = request.user.recruiter.employer if student in get_unlocked_students(employer, request.META["has_at_least_premium"]): if len(resume_book.students.visible()) >= s.RESUME_BOOK_CAPACITY: raise Http403( "You already have the max number (%d) of allowed students in you resumebook!" % (s.RESUME_BOOK_CAPACITY) ) resume_book.students.add(student) if not request.user.recruiter.employer.name != "Umeqo": student.studentstatistics.add_to_resumebook_count += 1 student.studentstatistics.save() data["action"] = employer_enums.ADDED return HttpResponse(simplejson.dumps(data), mimetype="application/json")
def specific_student_resume(request, student_id): was_limited = getattr(request, 'limited', False) if was_limited: raise Http403("You have exceeded the resume viewing per minute limit. " + "Please wait before trying again and consider using the resume book tool for collecting resumes in batches.") try: student = Student.objects.get(id=student_id) except Student.DoesNotExist: raise Http404("A student with the id %s does not exist." % student_id) employer = request.user.recruiter.employer if not student in get_unlocked_students(employer, request.META['has_at_least_premium']): raise Http403("You have not unlocked this student yet and thus can't view their resume. To unlock him/her either upgrade your subscription or have him/her RSVP to or attend one of your events.") resume = student.resume.read() response = HttpResponse(resume, mimetype='application/pdf') response['Content-Disposition'] = 'inline; filename=%s_%s_%s.pdf' % (student.id, student.user.last_name.lower(), student.user.first_name.lower()) return response
def employer_resume_book_add_students(request): if not request.POST.has_key('student_ids'): raise Http400("Request POST is missing the student_ids.") try: resume_book = ResumeBook.objects.get(recruiter = request.user.recruiter, delivered=False) if len(resume_book.students.visible()) >= s.RESUME_BOOK_CAPACITY: raise Http403("You already have the max number (%d) of allowed students in you resumebook!" % (s.RESUME_BOOK_CAPACITY)) except ResumeBook.DoesNotExist: resume_book = ResumeBook.objects.create(recruiter = request.user.recruiter) employer = request.user.recruiter.employer unlocked_students = get_unlocked_students(employer, request.META['has_at_least_premium']) if request.POST['student_ids']: for id in request.POST['student_ids'].split('~'): student = Student.objects.get(id=id) if student in unlocked_students: if student not in resume_book.students.visible(): resume_book.students.add(student) if request.user.recruiter.employer.name != "Umeqo": student.studentstatistics.add_to_resumebook_count += 1 student.studentstatistics.save() return HttpResponse()
def employer_resume_book_add_students(request): if not request.POST.has_key("student_ids"): raise Http400("Request POST is missing the student_ids.") try: resume_book = ResumeBook.objects.get(recruiter=request.user.recruiter, delivered=False) if len(resume_book.students.visible()) >= s.RESUME_BOOK_CAPACITY: raise Http403( "You already have the max number (%d) of allowed students in you resumebook!" % (s.RESUME_BOOK_CAPACITY) ) except ResumeBook.DoesNotExist: resume_book = ResumeBook.objects.create(recruiter=request.user.recruiter) employer = request.user.recruiter.employer unlocked_students = get_unlocked_students(employer, request.META["has_at_least_premium"]) if request.POST["student_ids"]: for id in request.POST["student_ids"].split("~"): student = Student.objects.get(id=id) if student in unlocked_students: if student not in resume_book.students.visible(): resume_book.students.add(student) if request.user.recruiter.employer.name != "Umeqo": student.studentstatistics.add_to_resumebook_count += 1 student.studentstatistics.save() return HttpResponse()
def employer_resume_book_toggle_student(request): if not request.POST.has_key('student_id'): raise Http400("Request POST is missing the student_id.") student = Student.objects.get(id=request.POST['student_id']) try: resume_book = ResumeBook.objects.get(recruiter = request.user.recruiter, delivered=False) except ResumeBook.DoesNotExist: resume_book = ResumeBook.objects.create(recruiter = request.user.recruiter) data = {} if student in resume_book.students.visible(): resume_book.students.remove(student) data['action'] = employer_enums.REMOVED else: employer = request.user.recruiter.employer if student in get_unlocked_students(employer, request.META['has_at_least_premium']): if len(resume_book.students.visible()) >= s.RESUME_BOOK_CAPACITY: raise Http403("You already have the max number (%d) of allowed students in you resumebook!" % (s.RESUME_BOOK_CAPACITY)) resume_book.students.add(student) if not request.user.recruiter.employer.name != "Umeqo": student.studentstatistics.add_to_resumebook_count += 1 student.studentstatistics.save() data['action'] = employer_enums.ADDED return HttpResponse(simplejson.dumps(data), mimetype="application/json")