made refractorings
This commit is contained in:
parent
b19ea638cc
commit
f04c867329
|
@ -13,5 +13,5 @@ urlpatterns = [
|
||||||
path("submitApplication/", adminViews.submitApplication, name="Submit Application"),
|
path("submitApplication/", adminViews.submitApplication, name="Submit Application"),
|
||||||
path('generateCSV/', adminViews.generateCSV, name="Generate CSV"),
|
path('generateCSV/', adminViews.generateCSV, name="Generate CSV"),
|
||||||
path('addPPO/', adminViews.addPPO, name="Add PPO"),
|
path('addPPO/', adminViews.addPPO, name="Add PPO"),
|
||||||
path('getstudentapplication/', adminViews.getstudentapplication, name="Get student application"),
|
path('getStudentApplication/', adminViews.getStudentApplication, name="Get student application"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -338,25 +338,37 @@ def addPPO(request, id, email, user_type):
|
||||||
@api_view(['POST'])
|
@api_view(['POST'])
|
||||||
@isAuthorized(allowed_users=[ADMIN])
|
@isAuthorized(allowed_users=[ADMIN])
|
||||||
@precheck(required_data=[STUDENT_ID, OPENING_ID])
|
@precheck(required_data=[STUDENT_ID, OPENING_ID])
|
||||||
def getstudentapplication(request, id, email, user_type):
|
def getStudentApplication(request, id, email, user_type):
|
||||||
try:
|
try:
|
||||||
data = request.data
|
data = request.data
|
||||||
student = get_object_or_404(Student, id=data[STUDENT_ID])
|
student = get_object_or_404(Student, id=data[STUDENT_ID])
|
||||||
student_serializer = StudentSerializer(student)
|
student_serializer = StudentSerializer(student)
|
||||||
|
student_details = {
|
||||||
|
"name": student_serializer.data['name'],
|
||||||
|
"batch": student.batch,
|
||||||
|
"branch": student.branch,
|
||||||
|
"resume_list": student_serializer.data['resume_list'],
|
||||||
|
}
|
||||||
# search for the application if there or not
|
# search for the application if there or not
|
||||||
application = PlacementApplication.objects.filter(student=student, placement=get_object_or_404(Placement, id=data[OPENING_ID]))
|
application = PlacementApplication.objects.filter(student=student, placement=get_object_or_404(Placement, id=data[OPENING_ID]))
|
||||||
logger.info("Get Student Application: " + str(application))
|
logger.info("Get Student Application: " + str(application))
|
||||||
if application:
|
if application:
|
||||||
serializer = PlacementApplicationSerializer(application[0])
|
serializer = PlacementApplicationSerializer(application[0])
|
||||||
return Response({'action': "Get Student Application", 'found': "true",'application_id': serializer.data["id"] ,
|
application_info = {
|
||||||
'application_additionalInfo': serializer.data[ADDITIONAL_INFO],"available_resumes": student_serializer.data["resume_list"],
|
"id": serializer.data['id'],
|
||||||
"student_name":student.name, "student_branch":student.branch, "student_batch":student.batch, "resume":serializer.data["resume_link"]},
|
"additional_info": serializer.data['additional_info'],
|
||||||
status=status.HTTP_200_OK)
|
"resume": serializer.data['resume'],
|
||||||
|
}
|
||||||
|
return Response({'action': "Get Student Application", 'application_found': "true", "application_info": application_info,
|
||||||
|
"student_details":student_details }, status=status.HTTP_200_OK)
|
||||||
else:
|
else:
|
||||||
return Response({'action': "Get Student Application", 'found': "false", "available_resumes": student_serializer.data["resume_list"],
|
return Response({'action': "Get Student Application", 'application_found': "false", "student_details": student_details},
|
||||||
"student_name":student.name, "student_branch":student.branch, "student_batch":student.batch},
|
status=status.HTTP_404_NOT_FOUND)
|
||||||
status=status.HTTP_200_OK)
|
except Http404:
|
||||||
except:
|
|
||||||
logger.warning("Get Student Application: " + str(sys.exc_info()))
|
logger.warning("Get Student Application: " + str(sys.exc_info()))
|
||||||
print(sys.exc_info())
|
print(sys.exc_info())
|
||||||
return Response({'action': "Get Student Application", 'message': "Student with given roll number not found."}, status.HTTP_400_BAD_REQUEST)
|
return Response({'action': "Get Student Application", 'message': "Student with given roll number not found."}, status.HTTP_400_BAD_REQUEST)
|
||||||
|
except:
|
||||||
|
logger.warning("Get Student Application: " + str(sys.exc_info()))
|
||||||
|
print(sys.exc_info())
|
||||||
|
return Response({'action': "Get Student Application", 'message': "Some error Occurred"}, status.HTTP_500_INTERNAL_SERVER_ERROR)
|
||||||
|
|
|
@ -132,7 +132,7 @@ class Placement(models.Model):
|
||||||
self.selection_procedure_details = self.selection_procedure_details.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
self.selection_procedure_details = self.selection_procedure_details.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
||||||
self.bond_details = self.bond_details.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
self.bond_details = self.bond_details.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
||||||
self.other_requirements = self.other_requirements.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
self.other_requirements = self.other_requirements.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
||||||
self.additinal_info = [info.strip()[:JNF_TEXTMEDIUM_MAX_CHARACTER_COUNT] for info in self.additional_info]
|
self.additional_info = [info.strip()[:JNF_TEXTMEDIUM_MAX_CHARACTER_COUNT] for info in self.additional_info]
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
''' On save, add timestamps '''
|
''' On save, add timestamps '''
|
||||||
|
|
Loading…
Reference in New Issue