autoFill JNF draft
This commit is contained in:
parent
4bfdba5dd5
commit
196dec66ee
Binary file not shown.
|
@ -5,4 +5,5 @@ from . import companyViews
|
|||
urlpatterns = [
|
||||
path('addPlacement/', companyViews.addPlacement, name="Add Placement"),
|
||||
path('verifyEmail/', companyViews.verifyEmail, name="Verify Email"),
|
||||
path('getAutoFillJnf/', companyViews.autoFillJnf, name="Auto FIll JNF"),
|
||||
]
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from rest_framework.decorators import api_view
|
||||
|
||||
from .utils import *
|
||||
from .serializers import *
|
||||
|
||||
logger = logging.getLogger('db')
|
||||
|
||||
|
@ -283,7 +284,8 @@ def verifyEmail(request):
|
|||
"opening_type": PLACEMENT,
|
||||
"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)
|
||||
|
||||
return Response({'action': "Verify Email", 'message': "Email Verified Successfully"},
|
||||
|
@ -298,3 +300,23 @@ def verifyEmail(request):
|
|||
logger.warning("Verify Email: " + str(sys.exc_info()))
|
||||
return Response({'action': "Verify Email", 'message': "Something went wrong"},
|
||||
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)
|
||||
|
|
|
@ -90,6 +90,7 @@ FIELD = "field"
|
|||
STATUS_ACCEPTING_APPLICATIONS = "Accepting Applications"
|
||||
|
||||
PLACEMENT = "Placement"
|
||||
PLACEMENT_ID = "placement_id"
|
||||
|
||||
COMPANY_NAME = "company_name"
|
||||
ADDRESS = "address"
|
||||
|
@ -158,7 +159,6 @@ STUDENT_APPLICATION_SUBMITTED_TEMPLATE_SUBJECT = 'CDC - Application Submitted -
|
|||
STUDENT_APPLICATION_UPDATED_TEMPLATE_SUBJECT = 'CDC - Application Updated - {company_name}'
|
||||
COMPANY_EMAIl_VERIFICATION_TEMPLATE_SUBJECT = 'Email Verification - Career Development Cell, IIT Dharwad'
|
||||
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'
|
||||
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_JNF_RESPONSE_TEMPLATE = 'company_jnf_response.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',
|
||||
'Resume', 'Selected', ]
|
||||
|
|
|
@ -162,8 +162,7 @@ class PlacementApplicationSerializer(serializers.ModelSerializer):
|
|||
return data
|
||||
|
||||
def get_resume_link(self, obj):
|
||||
ele = {'link': LINK_TO_STORAGE_RESUME + urllib.parse.quote(str(obj.student.roll_no) + "/" + obj.resume),
|
||||
'name': obj.resume}
|
||||
ele = {'link': LINK_TO_STORAGE_RESUME + urllib.parse.quote(str(obj.student.roll_no) + "/" + obj.resume), 'name': obj.resume}
|
||||
return ele
|
||||
|
||||
class Meta:
|
||||
|
@ -187,8 +186,13 @@ class PlacementApplicationSerializerForAdmin(serializers.ModelSerializer):
|
|||
model = PlacementApplication
|
||||
exclude = ['placement', 'resume']
|
||||
|
||||
|
||||
class ContributorSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = Contributor
|
||||
|
||||
|
||||
|
||||
class AutofillSerializers(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = Placement
|
||||
fields = '__all__'
|
|
@ -267,6 +267,8 @@ def verify_recaptcha(request):
|
|||
}
|
||||
r = rq.post('https://www.google.com/recaptcha/api/siteverify', data=data)
|
||||
result = r.json()
|
||||
# print
|
||||
print(result)
|
||||
if not result['success']:
|
||||
logger.warning("Utils - verify_recaptcha: " + str(result))
|
||||
return result['success']
|
||||
|
|
|
@ -47,9 +47,7 @@ INSTALLED_APPS = [
|
|||
'background_task',
|
||||
'simple_history',
|
||||
'import_export',
|
||||
'django_extensions',
|
||||
"django_extensions"
|
||||
|
||||
'django_extensions'
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
|
Loading…
Reference in New Issue