Merge pull request #160 from CDC-IITDH:autoFIllJnf

autoFill JNF draft
This commit is contained in:
karthik mv 2023-06-06 23:10:41 +05:30 committed by GitHub
commit 09abae7a5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 36 additions and 12 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"
@ -159,7 +160,6 @@ STUDENT_APPLICATION_UPDATED_TEMPLATE_SUBJECT = 'CDC - Application Updated - {com
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}' 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'
STUDENT_APPLICATION_STATUS_SELECTED_TEMPLATE = 'student_application_status_selected.html' STUDENT_APPLICATION_STATUS_SELECTED_TEMPLATE = 'student_application_status_selected.html'
@ -169,7 +169,6 @@ 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' 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
fields = '__all__'
class AutofillSerializers(serializers.ModelSerializer):
class Meta:
model = Placement
fields = '__all__'

View File

@ -285,7 +285,7 @@ def opening_description_table_html(opening):
else: # if isinstance(opening, QueryDict): else: # if isinstance(opening, QueryDict):
details = opening details = opening
keys = list(details.keys()) keys = list(details.keys())
newdetails = {} newdetails = {"ID": opening.id}
for key in keys: for key in keys:
if isinstance(details[key], list): if isinstance(details[key], list):
details[key] = {"details": details[key], "type": ["list"]} details[key] = {"details": details[key], "type": ["list"]}

View File

@ -30,7 +30,7 @@ DEBUG = os.environ.get('DEBUG') == "True"
ALLOWED_HOSTS = ['cdc.iitdh.ac.in', 'localhost'] ALLOWED_HOSTS = ['cdc.iitdh.ac.in', 'localhost']
ADMINS = [('Gowtham Sai', '190010036@iitdh.ac.in'), ('Karthik Mv', '200010030@iitdh.ac.in')] ADMINS = [ ('Karthik Mv', '200010030@iitdh.ac.in')]
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
@ -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 = [