autoFill JNF draft

This commit is contained in:
Jaya Surya 2023-06-02 22:44:07 +05:30
parent 4bfdba5dd5
commit 196dec66ee
8 changed files with 36 additions and 10 deletions

BIN
.DS_Store vendored

Binary file not shown.

BIN
CDC_Backend/.DS_Store vendored

Binary file not shown.

View File

@ -5,4 +5,5 @@ from . import companyViews
urlpatterns = [ urlpatterns = [
path('addPlacement/', companyViews.addPlacement, name="Add Placement"), path('addPlacement/', companyViews.addPlacement, name="Add Placement"),
path('verifyEmail/', companyViews.verifyEmail, name="Verify Email"), path('verifyEmail/', companyViews.verifyEmail, name="Verify Email"),
path('getAutoFillJnf/', companyViews.autoFillJnf, name="Auto FIll JNF"),
] ]

View File

@ -1,6 +1,7 @@
from rest_framework.decorators import api_view from rest_framework.decorators import api_view
from .utils import * from .utils import *
from .serializers import *
logger = logging.getLogger('db') logger = logging.getLogger('db')
@ -283,7 +284,8 @@ def verifyEmail(request):
"opening_type": PLACEMENT, "opening_type": PLACEMENT,
"company_name": opening.company_name, "company_name": opening.company_name,
} }
sendEmail([opening.email, CDC_MAIl_ADDRESS], COMPANY_OPENING_SUBMITTED_TEMPLATE_SUBJECT.format(id=opening.id), data, sendEmail([opening.email, CDC_MAIl_ADDRESS],
COMPANY_OPENING_SUBMITTED_TEMPLATE_SUBJECT.format(id=opening.id), data,
COMPANY_OPENING_SUBMITTED_TEMPLATE, attachment_jnf_respone) COMPANY_OPENING_SUBMITTED_TEMPLATE, attachment_jnf_respone)
return Response({'action': "Verify Email", 'message': "Email Verified Successfully"}, return Response({'action': "Verify Email", 'message': "Email Verified Successfully"},
@ -298,3 +300,23 @@ def verifyEmail(request):
logger.warning("Verify Email: " + str(sys.exc_info())) logger.warning("Verify Email: " + str(sys.exc_info()))
return Response({'action': "Verify Email", 'message': "Something went wrong"}, return Response({'action': "Verify Email", 'message': "Something went wrong"},
status=status.HTTP_400_BAD_REQUEST) status=status.HTTP_400_BAD_REQUEST)
@api_view(['GET'])
@precheck([PLACEMENT_ID])
def autoFillJnf(request):
try:
data = request.GET
placement_id = data.get(PLACEMENT_ID)
opening = get_object_or_404(Placement, id=placement_id)
serializer = AutofillSerializers(opening)
return Response({'action': "Get AutoFill", 'message': 'Data Found', 'placement_data': serializer.data},
status=status.HTTP_200_OK)
except Http404:
return Response({'action': "Get AutoFill", 'message': 'Placement Not Found'},
status=status.HTTP_404_NOT_FOUND)
except Exception as e:
traceback_str = traceback.format_exc()
logger.warning("Get AutoFill: " + traceback_str)
return Response({'action': "Get AutoFill", 'message': "Something went wrong"},
status=status.HTTP_400_BAD_REQUEST)

View File

@ -90,6 +90,7 @@ FIELD = "field"
STATUS_ACCEPTING_APPLICATIONS = "Accepting Applications" STATUS_ACCEPTING_APPLICATIONS = "Accepting Applications"
PLACEMENT = "Placement" PLACEMENT = "Placement"
PLACEMENT_ID = "placement_id"
COMPANY_NAME = "company_name" COMPANY_NAME = "company_name"
ADDRESS = "address" ADDRESS = "address"
@ -158,7 +159,6 @@ STUDENT_APPLICATION_SUBMITTED_TEMPLATE_SUBJECT = 'CDC - Application Submitted -
STUDENT_APPLICATION_UPDATED_TEMPLATE_SUBJECT = 'CDC - Application Updated - {company_name}' STUDENT_APPLICATION_UPDATED_TEMPLATE_SUBJECT = 'CDC - Application Updated - {company_name}'
COMPANY_EMAIl_VERIFICATION_TEMPLATE_SUBJECT = 'Email Verification - Career Development Cell, IIT Dharwad' COMPANY_EMAIl_VERIFICATION_TEMPLATE_SUBJECT = 'Email Verification - Career Development Cell, IIT Dharwad'
NOTIFY_STUDENTS_OPENING_TEMPLATE_SUBJECT = 'Placement Opportunity at {company_name}' NOTIFY_STUDENTS_OPENING_TEMPLATE_SUBJECT = 'Placement Opportunity at {company_name}'
REMINDER_STUDENTS_OPENING_TEMPLATE_SUBJECT = 'Reminder - Placement Opportunity at {company_name}'
STUDENT_APPLICATION_SUBMITTED_TEMPLATE = 'student_application_submitted.html' STUDENT_APPLICATION_SUBMITTED_TEMPLATE = 'student_application_submitted.html'
COMPANY_OPENING_SUBMITTED_TEMPLATE = 'company_opening_submitted.html' COMPANY_OPENING_SUBMITTED_TEMPLATE = 'company_opening_submitted.html'
@ -168,7 +168,6 @@ STUDENT_APPLICATION_UPDATED_TEMPLATE = 'student_application_updated.html'
COMPANY_EMAIL_VERIFICATION_TEMPLATE = 'company_email_verification.html' COMPANY_EMAIL_VERIFICATION_TEMPLATE = 'company_email_verification.html'
COMPANY_JNF_RESPONSE_TEMPLATE = 'company_jnf_response.html' COMPANY_JNF_RESPONSE_TEMPLATE = 'company_jnf_response.html'
NOTIFY_STUDENTS_OPENING_TEMPLATE = 'notify_students_new_opening.html' NOTIFY_STUDENTS_OPENING_TEMPLATE = 'notify_students_new_opening.html'
REMINDER_STUDENTS_OPENING_TEMPLATE = 'students_opening_reminder.html'
APPLICATION_CSV_COL_NAMES = ['Applied At', 'Roll No.', 'Name', 'Email', 'Phone Number', 'Branch', 'Batch', 'CPI', APPLICATION_CSV_COL_NAMES = ['Applied At', 'Roll No.', 'Name', 'Email', 'Phone Number', 'Branch', 'Batch', 'CPI',
'Resume', 'Selected', ] 'Resume', 'Selected', ]

View File

@ -162,8 +162,7 @@ class PlacementApplicationSerializer(serializers.ModelSerializer):
return data return data
def get_resume_link(self, obj): def get_resume_link(self, obj):
ele = {'link': LINK_TO_STORAGE_RESUME + urllib.parse.quote(str(obj.student.roll_no) + "/" + obj.resume), ele = {'link': LINK_TO_STORAGE_RESUME + urllib.parse.quote(str(obj.student.roll_no) + "/" + obj.resume), 'name': obj.resume}
'name': obj.resume}
return ele return ele
class Meta: class Meta:
@ -187,8 +186,13 @@ class PlacementApplicationSerializerForAdmin(serializers.ModelSerializer):
model = PlacementApplication model = PlacementApplication
exclude = ['placement', 'resume'] exclude = ['placement', 'resume']
class ContributorSerializer(serializers.ModelSerializer): class ContributorSerializer(serializers.ModelSerializer):
class Meta: class Meta:
model = Contributor model = Contributor
class AutofillSerializers(serializers.ModelSerializer):
class Meta:
model = Placement
fields = '__all__' fields = '__all__'

View File

@ -267,6 +267,8 @@ def verify_recaptcha(request):
} }
r = rq.post('https://www.google.com/recaptcha/api/siteverify', data=data) r = rq.post('https://www.google.com/recaptcha/api/siteverify', data=data)
result = r.json() result = r.json()
# print
print(result)
if not result['success']: if not result['success']:
logger.warning("Utils - verify_recaptcha: " + str(result)) logger.warning("Utils - verify_recaptcha: " + str(result))
return result['success'] return result['success']

View File

@ -47,9 +47,7 @@ INSTALLED_APPS = [
'background_task', 'background_task',
'simple_history', 'simple_history',
'import_export', 'import_export',
'django_extensions', 'django_extensions'
"django_extensions"
] ]
MIDDLEWARE = [ MIDDLEWARE = [