Compare commits
1 Commits
0e64af83a4
...
f4beeb87a3
Author | SHA1 | Date |
---|---|---|
Sreenivasu Akella | f4beeb87a3 |
|
@ -13,7 +13,6 @@ urlpatterns = [
|
|||
path('getApplications/', adminViews.getApplications, name="Get Applications"),
|
||||
path("submitApplication/", adminViews.submitApplication, name="Submit Application"),
|
||||
path('generateCSV/', adminViews.generateCSV, name="Generate CSV"),
|
||||
path('downloadResume/', adminViews.downloadResume, name="Download Resume"),
|
||||
path('addPPO/', adminViews.addPPO, name="Add PPO"),
|
||||
path('getStudentApplication/', adminViews.getStudentApplication, name="Get student application"),
|
||||
path('getStats/', adminViews.getStats, name="Get Stats"),
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import csv
|
||||
import zipfile
|
||||
|
||||
from rest_framework.decorators import api_view
|
||||
|
||||
|
@ -459,43 +458,6 @@ def generateCSV(request, id, email, user_type):
|
|||
status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
|
||||
@api_view(['POST'])
|
||||
@isAuthorized(allowed_users=[ADMIN])
|
||||
@precheck(required_data=[OPENING_ID])
|
||||
def downloadResume(request, id, email, user_type):
|
||||
try:
|
||||
data = request.data
|
||||
if OPENING_TYPE in data:
|
||||
opening_type= data[OPENING_TYPE]
|
||||
else:
|
||||
opening_type= "Placement"
|
||||
if opening_type == "Internship":
|
||||
opening = get_object_or_404(Internship, id=data[OPENING_ID])
|
||||
applications = InternshipApplication.objects.filter(internship=opening)
|
||||
else:
|
||||
opening = get_object_or_404(Placement, id=data[OPENING_ID])
|
||||
applications = PlacementApplication.objects.filter(placement=opening)
|
||||
zip_filename = generateRandomString() + ".zip"
|
||||
if not os.path.isdir(STORAGE_DESTINATION_RESUME_ZIP):
|
||||
os.makedirs(STORAGE_DESTINATION_RESUME_ZIP, exist_ok=True)
|
||||
resumes = {}
|
||||
for apl in applications:
|
||||
if apl.selected:
|
||||
resumes[apl.student.roll_no] = STORAGE_DESTINATION_RESUMES + apl.student.id + '/' + apl.resume # Check if the folder name is student id or user id
|
||||
|
||||
with zipfile.ZipFile(STORAGE_DESTINATION_RESUME_ZIP + zip_filename, 'w', zipfile.ZIP_DEFLATED) as zip_file:
|
||||
for student_roll_no, resume_path in resumes.items():
|
||||
zip_file.write(resume_path, os.path.basename(str(student_roll_no) + ".pdf"))
|
||||
|
||||
file_path = LINK_TO_RESUMES_ZIP + urllib.parse.quote_plus(zip_filename)
|
||||
return Response({'action': "Download resumes", 'message': "Resumes zip created", 'file': file_path},
|
||||
status=status.HTTP_200_OK)
|
||||
except:
|
||||
logger.warning("Create csv: " + str(sys.exc_info()))
|
||||
return Response({'action': "Create csv", 'message': "Something Went Wrong"},
|
||||
status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
|
||||
@api_view(['POST'])
|
||||
@isAuthorized(allowed_users=[ADMIN])
|
||||
@precheck(required_data=[COMPANY_NAME, COMPENSATION_GROSS, OFFER_ACCEPTED, STUDENT_ID, DESIGNATION, TIER])
|
||||
|
|
|
@ -88,7 +88,6 @@ PLACEMENT_OPENING_URL = "https://cdc.iitdh.ac.in/portal/student/dashboard/placem
|
|||
LINK_TO_STORAGE_COMPANY_ATTACHMENT = "https://cdc.iitdh.ac.in/storage/Company_Attachments/"
|
||||
LINK_TO_STORAGE_RESUME = "https://cdc.iitdh.ac.in/storage/Resumes/"
|
||||
LINK_TO_APPLICATIONS_CSV = "https://cdc.iitdh.ac.in/storage/Application_CSV/"
|
||||
LINK_TO_RESUMES_ZIP = "https://cdc.iitdh.ac.in/storage/Resume_Zips/"
|
||||
LINK_TO_EMAIl_VERIFICATION_API = "https://cdc.iitdh.ac.in/portal/company/verifyEmail?token={token}"
|
||||
PDF_FILES_SERVING_ENDPOINT = 'https://cdc.iitdh.ac.in/storage/Company_Attachments/' # TODO: Change this to actual URL
|
||||
|
||||
|
@ -116,7 +115,6 @@ JNF_SMALLTEXT_MAX_CHARACTER_COUNT = 50
|
|||
STORAGE_DESTINATION_RESUMES = "./Storage/Resumes/"
|
||||
STORAGE_DESTINATION_COMPANY_ATTACHMENTS = './Storage/Company_Attachments/'
|
||||
STORAGE_DESTINATION_APPLICATION_CSV = './Storage/Application_CSV/'
|
||||
STORAGE_DESTINATION_RESUME_ZIP = './Storage/Resume_Zips/'
|
||||
|
||||
TOKEN = 'token'
|
||||
RESUME_FILE_NAME = 'resume_file_name'
|
||||
|
|
Loading…
Reference in New Issue