Reformatted Code and Optimized Imports

This commit is contained in:
gowtham 2022-05-02 17:16:56 +05:30
parent af449eeaa7
commit 20a570e842
25 changed files with 206 additions and 150 deletions

View File

@ -1,17 +1,14 @@
from django.contrib import admin from django.contrib import admin
from .models import *
from django.contrib import admin
from django.contrib.admin.templatetags.admin_urls import admin_urlname from django.contrib.admin.templatetags.admin_urls import admin_urlname
from django.shortcuts import resolve_url from django.shortcuts import resolve_url
from django.utils.html import format_html from django.utils.html import format_html
from django.utils.safestring import SafeText from django.utils.safestring import SafeText
from .models import * from .models import *
admin.site.register(User) admin.site.register(User)
admin.site.register(Admin) admin.site.register(Admin)
admin.site.site_header = "CDC Recruitment Portal" admin.site.site_header = "CDC Recruitment Portal"
@ -22,10 +19,21 @@ def model_admin_url(obj, name=None) -> str:
@admin.register(Student) @admin.register(Student)
class Student(admin.ModelAdmin): class Student(admin.ModelAdmin):
list_display = ("roll_no", "name", "batch", "branch", "phone_number") list_display = ("roll_no", "name", "batch", "branch", "phone_number", 'can_apply')
search_fields = ("roll_no", "name","phone_number") search_fields = ("roll_no", "name", "phone_number")
ordering = ("roll_no", "name", "batch", "branch", "phone_number") ordering = ("roll_no", "name", "batch", "branch", "phone_number")
list_filter = ("batch", "branch") list_filter = ("batch", "branch")
actions = ['mark_can_apply_as_no', 'mark_can_apply_as_yes']
@admin.action(description="Deregister students")
def mark_can_apply_as_no(self, request, queryset):
queryset.update(can_apply=False)
self.message_user(request, "Deregistered the users")
@admin.action(description="Register students")
def mark_can_apply_as_yes(self, request, queryset):
queryset.update(can_apply=True)
self.message_user(request, "Registered the users")
@admin.register(Placement) @admin.register(Placement)
@ -52,11 +60,10 @@ class PlacementApplication(admin.ModelAdmin):
@admin.register(PrePlacementOffer) @admin.register(PrePlacementOffer)
class PrePlacementOffer(admin.ModelAdmin): class PrePlacementOffer(admin.ModelAdmin):
list_display = ('company', 'Student', 'accepted') list_display = ('company', 'Student', 'accepted')
search_fields = ('company',) search_fields = ('company',)
ordering = ('company',) ordering = ('company',)
list_filter = ('accepted',) list_filter = ('accepted',)
def Student(self, obj): def Student(self, obj):
return model_admin_url(obj.student) return model_admin_url(obj.student)

View File

@ -1,6 +1,6 @@
from django.urls import path from django.urls import path
from . import adminViews
from . import adminViews
urlpatterns = [ urlpatterns = [
path('markStatus/', adminViews.markStatus, name="Mark Status"), path('markStatus/', adminViews.markStatus, name="Mark Status"),

View File

@ -1,5 +1,4 @@
import csv import csv
import json
from rest_framework.decorators import api_view from rest_framework.decorators import api_view
@ -306,6 +305,7 @@ def generateCSV(request, id, email, user_type):
return Response({'action': "Create csv", 'message': "Error Occurred"}, return Response({'action': "Create csv", 'message': "Error Occurred"},
status=status.HTTP_400_BAD_REQUEST) status=status.HTTP_400_BAD_REQUEST)
@api_view(['POST']) @api_view(['POST'])
@isAuthorized(allowed_users=[ADMIN]) @isAuthorized(allowed_users=[ADMIN])
@precheck(required_data=[COMPANY_NAME, COMPENSATION_GROSS, OFFER_ACCEPTED, STUDENT_ID, DESIGNATION, TIER]) @precheck(required_data=[COMPANY_NAME, COMPENSATION_GROSS, OFFER_ACCEPTED, STUDENT_ID, DESIGNATION, TIER])

View File

@ -1,6 +1,6 @@
from django.urls import path from django.urls import path
from . import companyViews
from . import companyViews
urlpatterns = [ urlpatterns = [
path('addPlacement/', companyViews.addPlacement, name="Add Placement"), path('addPlacement/', companyViews.addPlacement, name="Add Placement"),

View File

@ -1,7 +1,5 @@
from rest_framework.decorators import api_view from rest_framework.decorators import api_view
from django.forms.models import model_to_dict
from .models import *
from .utils import * from .utils import *
logger = logging.getLogger('db') logger = logging.getLogger('db')

View File

@ -39,7 +39,7 @@ TOTAL_BATCHES = 4 # Total No of Batches
CLIENT_ID = "956830229554-290mirc16pdhd5j7ph7v7ukibo4t1qcp.apps.googleusercontent.com" # Google Login Client ID CLIENT_ID = "956830229554-290mirc16pdhd5j7ph7v7ukibo4t1qcp.apps.googleusercontent.com" # Google Login Client ID
# To be Configured Properly # To be Configured Properly
PLACEMENT_OPENING_URL = "https://www.googleapis.com/auth/adwords/{id}" # On frontend, this is the URL to be opened PLACEMENT_OPENING_URL = "https://www.googleapis.com/auth/adwords/{id}" # On frontend, this is the URL to be opened
LINK_TO_STORAGE_COMPANY_ATTACHMENT = "http://localhost/storage/Company_Attachments/" LINK_TO_STORAGE_COMPANY_ATTACHMENT = "http://localhost/storage/Company_Attachments/"
LINK_TO_STORAGE_RESUME = "http://localhost/storage/Resumes/" LINK_TO_STORAGE_RESUME = "http://localhost/storage/Resumes/"
LINK_TO_APPLICATIONS_CSV = "http://localhost/storage/Application_CSV/" LINK_TO_APPLICATIONS_CSV = "http://localhost/storage/Application_CSV/"
@ -54,8 +54,7 @@ TIER = 'tier'
# To be Configured Properly # To be Configured Properly
FOURTH_YEAR = '2019' FOURTH_YEAR = '2019'
MAX_OFFERS_PER_STUDENT = 2 MAX_OFFERS_PER_STUDENT = 2
EMAIL_VERIFICATION_TOKEN_TTL = 48 # in hours EMAIL_VERIFICATION_TOKEN_TTL = 48 # in hours
STORAGE_DESTINATION_RESUMES = "./Storage/Resumes/" STORAGE_DESTINATION_RESUMES = "./Storage/Resumes/"
STORAGE_DESTINATION_COMPANY_ATTACHMENTS = './Storage/Company_Attachments/' STORAGE_DESTINATION_COMPANY_ATTACHMENTS = './Storage/Company_Attachments/'
@ -88,7 +87,6 @@ STATE = 'state'
COUNTRY = 'country' COUNTRY = 'country'
PINCODE = 'pincode' PINCODE = 'pincode'
DESIGNATION = 'designation' DESIGNATION = 'designation'
DESCRIPTION = 'description' DESCRIPTION = 'description'
DESCRIPTION_PDF = 'description_pdf' DESCRIPTION_PDF = 'description_pdf'
@ -123,7 +121,6 @@ STUDENT_LIST = "student_list"
STUDENT_ID = "student_id" STUDENT_ID = "student_id"
STUDENT_SELECTED = "student_selected" STUDENT_SELECTED = "student_selected"
COMPANY_OPENING_SUBMITTED_TEMPLATE_SUBJECT = "Notification Submitted - {id} - Career Development Cell, IIT Dharwad" COMPANY_OPENING_SUBMITTED_TEMPLATE_SUBJECT = "Notification Submitted - {id} - Career Development Cell, IIT Dharwad"
STUDENT_APPLICATION_STATUS_TEMPLATE_SUBJECT = 'Application Status : {company_name} - {id}' STUDENT_APPLICATION_STATUS_TEMPLATE_SUBJECT = 'Application Status : {company_name} - {id}'
STUDENT_APPLICATION_SUBMITTED_TEMPLATE_SUBJECT = 'CDC - Application Submitted - {company_name}' STUDENT_APPLICATION_SUBMITTED_TEMPLATE_SUBJECT = 'CDC - Application Submitted - {company_name}'
@ -139,4 +136,4 @@ COMPANY_JNF_RESPONSE_TEMPLATE = 'company_jnf_response.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', ]
PDF_FILES_SERVING_ENDPOINT = 'http://localhost:5500/CDC_Backend/Storage/Company_Attachments/' # TODO: Change this to actual URL PDF_FILES_SERVING_ENDPOINT = 'http://localhost:5500/CDC_Backend/Storage/Company_Attachments/' # TODO: Change this to actual URL

View File

@ -1,15 +1,18 @@
from django.contrib.postgres.fields import ArrayField from django.contrib.postgres.fields import ArrayField
from django.db import models from django.db import models
from django.utils import timezone from django.utils import timezone
from .constants import *
# from .utils import *
from .constants import *
# from .utils import *
class User(models.Model): class User(models.Model):
email = models.CharField(primary_key=True, blank=False, max_length=50) email = models.CharField(primary_key=True, blank=False, max_length=50)
id = models.CharField(blank=False, max_length=25) id = models.CharField(blank=False, max_length=25)
user_type = ArrayField(models.CharField(blank=False, max_length=10), size=4, default=list, blank=False) user_type = ArrayField(models.CharField(blank=False, max_length=10), size=4, default=list, blank=False)
last_login_time = models.DateTimeField(default=timezone.now)
class Student(models.Model): class Student(models.Model):
@ -21,7 +24,7 @@ class Student(models.Model):
phone_number = models.PositiveBigIntegerField(blank=True, default=None, null=True) phone_number = models.PositiveBigIntegerField(blank=True, default=None, null=True)
resumes = ArrayField(models.CharField(null=True, default=None, max_length=100), size=10, default=list, blank=True) resumes = ArrayField(models.CharField(null=True, default=None, max_length=100), size=10, default=list, blank=True)
cpi = models.DecimalField(decimal_places=2, max_digits=4) cpi = models.DecimalField(decimal_places=2, max_digits=4)
can_apply = models.BooleanField(default=True) can_apply = models.BooleanField(default=True, verbose_name='Registered')
def __str__(self): def __str__(self):
return str(self.roll_no) return str(self.roll_no)
@ -45,7 +48,8 @@ class Placement(models.Model):
nature_of_business = models.CharField(blank=False, max_length=50, default="") nature_of_business = models.CharField(blank=False, max_length=50, default="")
website = models.CharField(blank=True, max_length=50) website = models.CharField(blank=True, max_length=50)
company_details = models.CharField(max_length=500, default=None, null=True) company_details = models.CharField(max_length=500, default=None, null=True)
company_details_pdf_names = ArrayField(models.CharField(null=True, default=None, max_length=100), size=5, default=list, blank=True) company_details_pdf_names = ArrayField(models.CharField(null=True, default=None, max_length=100), size=5,
default=list, blank=True)
is_company_details_pdf = models.BooleanField(blank=False, default=False) is_company_details_pdf = models.BooleanField(blank=False, default=False)
contact_person_name = models.CharField(blank=False, max_length=50) contact_person_name = models.CharField(blank=False, max_length=50)
phone_number = models.PositiveBigIntegerField(blank=False) phone_number = models.PositiveBigIntegerField(blank=False)
@ -53,24 +57,28 @@ class Placement(models.Model):
city = models.CharField(blank=False, max_length=100, default="") city = models.CharField(blank=False, max_length=100, default="")
state = models.CharField(blank=False, max_length=100, default="") state = models.CharField(blank=False, max_length=100, default="")
country = models.CharField(blank=False, max_length=100, default="") country = models.CharField(blank=False, max_length=100, default="")
pin_code = models.IntegerField(blank=False, default=None,null=True) pin_code = models.IntegerField(blank=False, default=None, null=True)
city_type = models.CharField(blank=False, max_length=15, choices=OFFER_CITY_TYPE) city_type = models.CharField(blank=False, max_length=15, choices=OFFER_CITY_TYPE)
# Job Details # Job Details
designation = models.CharField(blank=False, max_length=50, default=None, null=True) designation = models.CharField(blank=False, max_length=50, default=None, null=True)
description = models.CharField(blank=False, max_length=500, default=None, null=True) description = models.CharField(blank=False, max_length=500, default=None, null=True)
description_pdf_names = ArrayField(models.CharField(null=True, default=None, max_length=100), size=5, default=list, blank=True) description_pdf_names = ArrayField(models.CharField(null=True, default=None, max_length=100), size=5, default=list,
blank=True)
is_description_pdf = models.BooleanField(blank=False, default=False) is_description_pdf = models.BooleanField(blank=False, default=False)
compensation_CTC = models.IntegerField(blank=False, default=None, null=True ) # Job - Per Year compensation_CTC = models.IntegerField(blank=False, default=None, null=True) # Job - Per Year
compensation_gross = models.IntegerField(blank=False, default=None, null=True) compensation_gross = models.IntegerField(blank=False, default=None, null=True)
compensation_take_home = models.IntegerField(blank=False, default=None, null=True) compensation_take_home = models.IntegerField(blank=False, default=None, null=True)
compensation_bonus = models.IntegerField(blank=True, default=None, null=True) compensation_bonus = models.IntegerField(blank=True, default=None, null=True)
compensation_details = models.CharField(blank=True, max_length=500, default=None, null=True) compensation_details = models.CharField(blank=True, max_length=500, default=None, null=True)
compensation_details_pdf_names = ArrayField(models.CharField(null=True, default=None, max_length=100), size=5, default=list, blank=True) compensation_details_pdf_names = ArrayField(models.CharField(null=True, default=None, max_length=100), size=5,
default=list, blank=True)
is_compensation_details_pdf = models.BooleanField(blank=False, default=False) is_compensation_details_pdf = models.BooleanField(blank=False, default=False)
bond_details = models.CharField(blank=True, max_length=500) bond_details = models.CharField(blank=True, max_length=500)
selection_procedure_rounds = ArrayField(models.CharField(null=True, default=None, max_length=100), size=10, default=list, blank=True) selection_procedure_rounds = ArrayField(models.CharField(null=True, default=None, max_length=100), size=10,
default=list, blank=True)
selection_procedure_details = models.CharField(blank=True, max_length=500) selection_procedure_details = models.CharField(blank=True, max_length=500)
selection_procedure_details_pdf_names = ArrayField(models.CharField(null=True, default=None, max_length=100), size=5, default=list, blank=True) selection_procedure_details_pdf_names = ArrayField(models.CharField(null=True, default=None, max_length=100),
size=5, default=list, blank=True)
is_selection_procedure_details_pdf = models.BooleanField(blank=False, default=False) is_selection_procedure_details_pdf = models.BooleanField(blank=False, default=False)
tier = models.CharField(blank=False, choices=TIERS, max_length=10, default=None, null=True) tier = models.CharField(blank=False, choices=TIERS, max_length=10, default=None, null=True)
tentative_date_of_joining = models.DateField(blank=False, verbose_name="Tentative Date", default=timezone.now) tentative_date_of_joining = models.DateField(blank=False, verbose_name="Tentative Date", default=timezone.now)
@ -103,6 +111,7 @@ class Placement(models.Model):
def __str__(self): def __str__(self):
return self.company_name + " - " + self.id return self.company_name + " - " + self.id
class PlacementApplication(models.Model): class PlacementApplication(models.Model):
id = models.CharField(blank=False, primary_key=True, max_length=15) id = models.CharField(blank=False, primary_key=True, max_length=15)
placement = models.ForeignKey(Placement, blank=False, on_delete=models.RESTRICT, default=None, null=True) placement = models.ForeignKey(Placement, blank=False, on_delete=models.RESTRICT, default=None, null=True)

View File

@ -1,6 +1,7 @@
import urllib import urllib
from rest_framework import serializers from rest_framework import serializers
from .models import * from .models import *
@ -95,7 +96,7 @@ class PlacementSerializerForStudent(serializers.ModelSerializer):
exclude = [CONTACT_PERSON_NAME, PHONE_NUMBER, EMAIL, COMPANY_DETAILS_PDF_NAMES, DESCRIPTION_PDF_NAMES, exclude = [CONTACT_PERSON_NAME, PHONE_NUMBER, EMAIL, COMPANY_DETAILS_PDF_NAMES, DESCRIPTION_PDF_NAMES,
COMPENSATION_DETAILS_PDF_NAMES, SELECTION_PROCEDURE_DETAILS_PDF_NAMES, OFFER_ACCEPTED, COMPENSATION_DETAILS_PDF_NAMES, SELECTION_PROCEDURE_DETAILS_PDF_NAMES, OFFER_ACCEPTED,
EMAIL_VERIFIED, EMAIL_VERIFIED,
] ]
depth = 1 depth = 1

View File

@ -1,6 +1,6 @@
from django.urls import path, include from django.urls import path
from . import studentViews
from . import studentViews
urlpatterns = [ urlpatterns = [
path('login/', studentViews.login, name="Login"), path('login/', studentViews.login, name="Login"),

View File

@ -1,8 +1,3 @@
import json
# from datetime import datetime
import datetime
import traceback
from rest_framework.decorators import api_view from rest_framework.decorators import api_view
from .serializers import * from .serializers import *
@ -75,7 +70,7 @@ def getDashboard(request, id, email, user_type):
placements = Placement.objects.filter(allowed_batch__contains=[studentDetails.batch], placements = Placement.objects.filter(allowed_batch__contains=[studentDetails.batch],
allowed_branch__contains=[studentDetails.branch], allowed_branch__contains=[studentDetails.branch],
deadline_datetime__gte=datetime.datetime.now(), deadline_datetime__gte=datetime.datetime.now(),
offer_accepted=True, email_verified=True).order_by('deadline_datetime') offer_accepted=True, email_verified=True).order_by('deadline_datetime')
placementsdata = PlacementSerializerForStudent(placements, many=True).data placementsdata = PlacementSerializerForStudent(placements, many=True).data
placementApplications = PlacementApplication.objects.filter(student_id=id) placementApplications = PlacementApplication.objects.filter(student_id=id)
placementApplications = PlacementApplicationSerializer(placementApplications, many=True).data placementApplications = PlacementApplicationSerializer(placementApplications, many=True).data

View File

@ -1,3 +1 @@
from django.test import TestCase
# Create your tests here. # Create your tests here.

View File

@ -1,4 +1,5 @@
from django.urls import path, include from django.urls import path, include
from . import studentViews, studentUrls, companyUrls, adminUrls from . import studentViews, studentUrls, companyUrls, adminUrls
urlpatterns = [ urlpatterns = [

View File

@ -1,4 +1,5 @@
import datetime import datetime
import json
import logging import logging
import os import os
import random import random
@ -7,9 +8,11 @@ import string
import sys import sys
import traceback import traceback
from os import path, remove from os import path, remove
import json
import background_task import background_task
import jwt import jwt
import pdfkit
import requests as rq
from django.conf import settings from django.conf import settings
from django.core.mail import EmailMultiAlternatives from django.core.mail import EmailMultiAlternatives
from django.forms.models import model_to_dict from django.forms.models import model_to_dict
@ -21,8 +24,6 @@ from google.auth.transport import requests
from google.oauth2 import id_token from google.oauth2 import id_token
from rest_framework import status from rest_framework import status
from rest_framework.response import Response from rest_framework.response import Response
import requests as rq
import pdfkit
from .constants import * from .constants import *
from .models import User, PrePlacementOffer, PlacementApplication, Placement from .models import User, PrePlacementOffer, PlacementApplication, Placement
@ -78,7 +79,8 @@ def isAuthorized(allowed_users=None):
print(email) print(email)
user = get_object_or_404(User, email=email) user = get_object_or_404(User, email=email)
if user: if user:
user.last_login_time = datetime.datetime.now()
user.save()
if len(set(user.user_type).intersection(set(allowed_users))) or allowed_users == '*': if len(set(user.user_type).intersection(set(allowed_users))) or allowed_users == '*':
return view_func(request, user.id, user.email, user.user_type, *args, **kwargs) return view_func(request, user.id, user.email, user.user_type, *args, **kwargs)
else: else:
@ -150,7 +152,8 @@ def sendEmail(email_to, subject, data, template, attachment_jnf_respone=None):
msg.attach_alternative(html_content, "text/html") msg.attach_alternative(html_content, "text/html")
if attachment_jnf_respone: if attachment_jnf_respone:
logger.info(attachment_jnf_respone) logger.info(attachment_jnf_respone)
pdf = pdfkit.from_string(attachment_jnf_respone['html'], False,options={"--enable-local-file-access": "",'--dpi':'96'}) pdf = pdfkit.from_string(attachment_jnf_respone['html'], False,
options={"--enable-local-file-access": "", '--dpi': '96'})
msg.attach(attachment_jnf_respone['name'], pdf, 'application/pdf') msg.attach(attachment_jnf_respone['name'], pdf, 'application/pdf')
msg.send() msg.send()
return True return True
@ -248,6 +251,7 @@ def generateOneTimeVerificationLink(email, opening_id, opening_type):
logger.warning("Utils - generateOneTimeVerificationLink: " + str(sys.exc_info())) logger.warning("Utils - generateOneTimeVerificationLink: " + str(sys.exc_info()))
return False, "_" return False, "_"
def verify_recaptcha(request): def verify_recaptcha(request):
try: try:
print(settings.RECAPTCHA_SECRET_KEY) print(settings.RECAPTCHA_SECRET_KEY)
@ -269,19 +273,25 @@ def verify_recaptcha(request):
logger.warning("Utils - verify_recaptcha: " + str(sys.exc_info())) logger.warning("Utils - verify_recaptcha: " + str(sys.exc_info()))
return False, "_" return False, "_"
def opening_description_table_html(opening): def opening_description_table_html(opening):
details = model_to_dict(opening, fields = [field.name for field in Placement._meta.fields], exclude = ['id','is_company_details_pdf','offer_accepted','is_description_pdf','is_compensation_details_pdf','is_selection_procedure_details_pdf','email_verified']) details = model_to_dict(opening, fields=[field.name for field in Placement._meta.fields],
exclude=['id', 'is_company_details_pdf', 'offer_accepted', 'is_description_pdf',
'is_compensation_details_pdf', 'is_selection_procedure_details_pdf',
'email_verified'])
keys = list(details.keys()) keys = list(details.keys())
newdetails = {} newdetails = {}
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"]}
if key in ['website','company_details_pdf_names','description_pdf_names','compensation_details_pdf_names','selection_procedure_pdf_names']: if key in ['website', 'company_details_pdf_names', 'description_pdf_names', 'compensation_details_pdf_names',
'selection_procedure_pdf_names']:
if key == 'website': if key == 'website':
details[key] = {"details": details[key], "type": ["link"]} details[key] = {"details": details[key], "type": ["link"]}
else: else:
details[key] = {"details": details[key]["details"], "type": ["list","link"], "link": PDF_FILES_SERVING_ENDPOINT+opening.id+"/"} details[key] = {"details": details[key]["details"], "type": ["list", "link"],
new_key = key.replace('_',' ') "link": PDF_FILES_SERVING_ENDPOINT + opening.id + "/"}
new_key = key.replace('_', ' ')
if key.endswith(' names'): if key.endswith(' names'):
new_key = key[:-6] new_key = key[:-6]
new_key = new_key.capitalize() new_key = new_key.capitalize()
@ -289,7 +299,7 @@ def opening_description_table_html(opening):
imagepath = os.path.abspath('./templates/image.png') imagepath = os.path.abspath('./templates/image.png')
print(imagepath) print(imagepath)
data = { data = {
"data": newdetails, "data": newdetails,
"imgpath": imagepath "imgpath": imagepath
} }
return render_to_string(COMPANY_JNF_RESPONSE_TEMPLATE, data) return render_to_string(COMPANY_JNF_RESPONSE_TEMPLATE, data)

View File

@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/2.2/ref/settings/
""" """
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
load_dotenv("../dev.env") load_dotenv("../dev.env")

View File

@ -158,7 +158,6 @@ Request_Body:
> Only users with `student` role can access this Api. > Only users with `student` role can access this Api.
### Response ### Response
Response is a Json with these fields Response is a Json with these fields
@ -565,8 +564,6 @@ Request_Body:
} }
``` ```
> Headers <br> > Headers <br>
> Authorization: "Bearer {tokenID}" > Authorization: "Bearer {tokenID}"
@ -728,7 +725,6 @@ Response is a Json with these fields
- ongoing: Gives us the list of placements that are accepting applications. - ongoing: Gives us the list of placements that are accepting applications.
- previous: Gives us the list of placements that stopped accepting applications. - previous: Gives us the list of placements that stopped accepting applications.
### Status Codes ### Status Codes
The possible responses for this api request are as follows The possible responses for this api request are as follows

View File

@ -6,7 +6,11 @@
"token_uri": "https://oauth2.googleapis.com/token", "token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "ZzvcweJylL1IDLUnYOi1ws2W", "client_secret": "ZzvcweJylL1IDLUnYOi1ws2W",
"redirect_uris": ["https://www.getpostman.com/oauth2/callback"], "redirect_uris": [
"javascript_origins": ["http://localhost:3000"] "https://www.getpostman.com/oauth2/callback"
],
"javascript_origins": [
"http://localhost:3000"
]
} }
} }

View File

@ -32,7 +32,8 @@
style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;"> style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;">
<tr> <tr>
<td align="center" style="padding:40px 0 30px 0;background:#334878;"> <td align="center" style="padding:40px 0 30px 0;background:#334878;">
<img src="https://drive.google.com/uc?id=1QTA6dB7jnsZfU1kzyUqfD_2V5xODpWFt" alt="" width="200" style="height:auto;display:block;"/> <img src="https://drive.google.com/uc?id=1QTA6dB7jnsZfU1kzyUqfD_2V5xODpWFt" alt="" width="200"
style="height:auto;display:block;"/>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -43,7 +44,8 @@
<td style="padding:0 0 36px 0;color:#153643;"> <td style="padding:0 0 36px 0;color:#153643;">
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;"> <p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;">
We have received your Job Notification. Kindly verify your email by clicking <a href="{{ one_time_link }}">here</a>. We have received your Job Notification. Kindly verify your email by clicking <a
href="{{ one_time_link }}">here</a>.
</p> </p>
</td> </td>
</tr> </tr>

View File

@ -5,57 +5,69 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<style> <style>
#details_table tr:nth-child(even) {background: #FFF} #details_table tr:nth-child(even) {
#details_table tr:nth-child(odd) {background: #bfe3f3} background: #FFF
#details_table td {padding: 10px; width: 50%;} }
#details_table{
#details_table tr:nth-child(odd) {
background: #bfe3f3
}
#details_table td {
padding: 10px;
width: 50%;
}
#details_table {
border: #334878 1px solid; border: #334878 1px solid;
border-collapse: collapse; border-collapse: collapse;
width: 80%; width: 80%;
margin:auto; margin: auto;
} }
</style> </style>
<title>Document</title> <title>Document</title>
</head> </head>
<body style="margin: 0;"> <body style="margin: 0;">
<header style="background-color: #334878;"><img style="height: 3cm; margin: auto; display: block; padding: 0.5cm;" src='{{imgpath}}' alt="cdc logo"></header>
<h1 style="text-align: center;"> Job Notification Form Response</h1>
<table id="details_table">
{% for key, value in data.items %}
<tr>
<td >
{{ key }}
</td>
<td>
{% if 'list' in value.type %}
{% for item in value.details %}
<li>
{% if 'link' in value.type and value.link %}
<a href="{{value.link|add:item}}">{{ item }}</a>
{% elif 'link' in value.type %}
<a href="{{item}}">{{ item }}</a>
{% else %}
{{ item }}
{% endif %}
</li>
{% endfor %}
{% else %}
{% if 'link' in value.type %}
<a href="{{ value.details }}">{{ value.details }}</a>
{% else %}
{{ value }}
{% endif %}
{% endif %}
</td>
</tr>
{% endfor %}
</table>
<p style="margin-left: 10%;">In case of any descripency regarding above details, please contact <a href="mailto:cdc@iitdh.ac.in">cdc@iitdh.ac.in</a>
</p> <header style="background-color: #334878;"><img style="height: 3cm; margin: auto; display: block; padding: 0.5cm;"
src='{{ imgpath }}' alt="cdc logo"></header>
<h1 style="text-align: center;"> Job Notification Form Response</h1>
<table id="details_table">
{% for key, value in data.items %}
<tr>
<td>
{{ key }}
</td>
<td>
{% if 'list' in value.type %}
{% for item in value.details %}
<li>
{% if 'link' in value.type and value.link %}
<a href="{{ value.link|add:item}}">{{ item }}</a>
{% elif 'link' in value.type %}
<a href="{{ item }}">{{ item }}</a>
{% else %}
{{ item }}
{% endif %}
</li>
{% endfor %}
{% else %}
{% if 'link' in value.type %}
<a href="{{ value.details }}">{{ value.details }}</a>
{% else %}
{{ value }}
{% endif %}
{% endif %}
</td>
</tr>
{% endfor %}
</table>
<p style="margin-left: 10%;">In case of any descripency regarding above details, please contact <a
href="mailto:cdc@iitdh.ac.in">cdc@iitdh.ac.in</a>
</p>
</body> </body>
</html> </html>

View File

@ -21,10 +21,20 @@
table, td, div, h1, p { table, td, div, h1, p {
font-family: 'Roboto', sans-serif; font-family: 'Roboto', sans-serif;
} }
#details_table tr:nth-child(even) {background: #FFF}
#details_table tr:nth-child(odd) {background: #f9f9f9} #details_table tr:nth-child(even) {
#details_table td {padding: 10px} background: #FFF
#details_table{ }
#details_table tr:nth-child(odd) {
background: #f9f9f9
}
#details_table td {
padding: 10px
}
#details_table {
border: #334878 1px solid; border: #334878 1px solid;
border-collapse: collapse; border-collapse: collapse;
} }
@ -40,7 +50,8 @@
style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;"> style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;">
<tr> <tr>
<td align="center" style="padding:40px 0 30px 0;background:#334878;"> <td align="center" style="padding:40px 0 30px 0;background:#334878;">
<img src="https://drive.google.com/uc?id=1QTA6dB7jnsZfU1kzyUqfD_2V5xODpWFt" alt="" width="200" style="height:auto;display:block;"/> <img src="https://drive.google.com/uc?id=1QTA6dB7jnsZfU1kzyUqfD_2V5xODpWFt" alt="" width="200"
style="height:auto;display:block;"/>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -52,8 +63,10 @@
<h1 style="font-size:24px;margin:0 0 20px 0;font-family: 'Roboto', sans-serif; <h1 style="font-size:24px;margin:0 0 20px 0;font-family: 'Roboto', sans-serif;
">Thank You for filling the form</h1> ">Thank You for filling the form</h1>
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;"> <p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;">
We have received your <b>{{ opening_type }}</b> notification for a <b>{{ designation }}</b> offer at <b> We have received your <b>{{ opening_type }}</b> notification for a
{{ company_name }}</b>. Click <a href="{{ opening_link }}">here</a> to view your notification. <b>{{ designation }}</b> offer at <b>
{{ company_name }}</b>. Click <a href="{{ opening_link }}">here</a> to view your
notification.
</p> </p>
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;"> <p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;">
We will keep you informed with the updates. If you have any queries, please We will keep you informed with the updates. If you have any queries, please
@ -64,30 +77,30 @@
<table id="details_table"> <table id="details_table">
{% for key, value in data.items %} {% for key, value in data.items %}
<tr> <tr>
<td > <td>
{{ key }} {{ key }}
</td> </td>
<td> <td>
{% if 'list' in value.type %} {% if 'list' in value.type %}
{% for item in value.details %} {% for item in value.details %}
<li> <li>
{% if 'link' in value.type and value.link %} {% if 'link' in value.type and value.link %}
<a href="{{value.link|add:item}}">{{ item }}</a> <a href="{{ value.link|add:item}}">{{ item }}</a>
{% elif 'link' in value.type %} {% elif 'link' in value.type %}
<a href="{{item}}">{{ item }}</a> <a href="{{ item }}">{{ item }}</a>
{% else %} {% else %}
{{ item }} {{ item }}
{% endif %} {% endif %}
</li> </li>
{% endfor %} {% endfor %}
{% else %} {% else %}
{% if 'link' in value.type %} {% if 'link' in value.type %}
<a href="{{ value.details }}">{{ value.details }}</a> <a href="{{ value.details }}">{{ value.details }}</a>
{% else %} {% else %}
{{ value }} {{ value }}
{% endif %} {% endif %}
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
@ -111,7 +124,6 @@
</td> </td>
</tr> </tr>
</table> </table>
</td> </td>

View File

@ -32,7 +32,8 @@
style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;"> style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;">
<tr> <tr>
<td align="center" style="padding:40px 0 30px 0;background:#334878;"> <td align="center" style="padding:40px 0 30px 0;background:#334878;">
<img src="https://drive.google.com/uc?id=1QTA6dB7jnsZfU1kzyUqfD_2V5xODpWFt" alt="" width="200" style="height:auto;display:block;"/> <img src="https://drive.google.com/uc?id=1QTA6dB7jnsZfU1kzyUqfD_2V5xODpWFt" alt="" width="200"
style="height:auto;display:block;"/>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -42,17 +43,19 @@
<tr> <tr>
<td style="padding:0 0 36px 0;color:#153643;"> <td style="padding:0 0 36px 0;color:#153643;">
<h1 style="font-size:24px;margin:0 0 20px 0;font-family: 'Roboto', sans-serif; <h1 style="font-size:24px;margin:0 0 20px 0;font-family: 'Roboto', sans-serif;
">{{opening_type}} Opportunity at {{company_name}}</h1> ">{{ opening_type }} Opportunity at {{ company_name }}</h1>
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;"> <p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;">
Greetings of the day. Hope you are fine and doing well ! Greetings of the day. Hope you are fine and doing well !
</p> </p>
<p style="text-indent: 4ch; margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;"> <p style="text-indent: 4ch; margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;">
CDC is excited to announce that <b>{{company_name}}</b> is interested in recruiting <b>{{designation}}</b> from IIT Dharwad. CDC is excited to announce that <b>{{ company_name }}</b> is interested in
recruiting <b>{{ designation }}</b> from IIT Dharwad.
More details can be found in the CDC-webportal. More details can be found in the CDC-webportal.
</p> </p>
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;"> <p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;">
Interested students can apply before <b>{{deadline}}</b> in the <a href="{{link}}">CDC-webportal</a>. Interested students can apply before <b>{{ deadline }}</b> in the <a
href="{{ link }}">CDC-webportal</a>.
</p> </p>
</td> </td>
</tr> </tr>
@ -72,7 +75,6 @@
</td> </td>
</tr> </tr>
</table> </table>
</td> </td>

View File

@ -31,7 +31,8 @@
style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;"> style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;">
<tr> <tr>
<td align="center" style="padding:40px 0 30px 0;background:#334878;"> <td align="center" style="padding:40px 0 30px 0;background:#334878;">
<img src="https://drive.google.com/uc?id=1QTA6dB7jnsZfU1kzyUqfD_2V5xODpWFt" alt="" width="200" style="height:auto;display:block;"/> <img src="https://drive.google.com/uc?id=1QTA6dB7jnsZfU1kzyUqfD_2V5xODpWFt" alt="" width="200"
style="height:auto;display:block;"/>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -43,7 +44,8 @@
<h1 style="font-size:24px;margin:0 0 20px 0;font-family: 'Roboto', sans-serif; <h1 style="font-size:24px;margin:0 0 20px 0;font-family: 'Roboto', sans-serif;
">Hey, {{ student_name }}</h1> ">Hey, {{ student_name }}</h1>
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;"> <p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;">
We regret to inform you that you have not been selected for <b>{{ designation }}</b> role at <b>{{ company_name }}</b>. We regret to inform you that you have not been selected for
<b>{{ designation }}</b> role at <b>{{ company_name }}</b>.
CDC will keep bringing more such opportunities for you in the future. CDC will keep bringing more such opportunities for you in the future.
</td> </td>
</tr> </tr>

View File

@ -31,7 +31,8 @@
style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;"> style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;">
<tr> <tr>
<td align="center" style="padding:40px 0 30px 0;background:#334878;"> <td align="center" style="padding:40px 0 30px 0;background:#334878;">
<img src="https://drive.google.com/uc?id=1QTA6dB7jnsZfU1kzyUqfD_2V5xODpWFt" alt="" width="200" style="height:auto;display:block;"/> <img src="https://drive.google.com/uc?id=1QTA6dB7jnsZfU1kzyUqfD_2V5xODpWFt" alt="" width="200"
style="height:auto;display:block;"/>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -43,7 +44,8 @@
<h1 style="font-size:24px;margin:0 0 20px 0;font-family: 'Roboto', sans-serif; <h1 style="font-size:24px;margin:0 0 20px 0;font-family: 'Roboto', sans-serif;
">Hey, {{ student_name }}</h1> ">Hey, {{ student_name }}</h1>
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;"> <p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;">
Congratulations, You have been selected for the <b>{{ designation }}</b> at <b>{{ company_name }}</b>.<br> Congratulations, You have been selected for the <b>{{ designation }}</b> at
<b>{{ company_name }}</b>.<br>
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@ -32,7 +32,8 @@
style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;"> style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;">
<tr> <tr>
<td align="center" style="padding:40px 0 30px 0;background:#334878;"> <td align="center" style="padding:40px 0 30px 0;background:#334878;">
<img src="https://drive.google.com/uc?id=1QTA6dB7jnsZfU1kzyUqfD_2V5xODpWFt" alt="" width="200" style="height:auto;display:block;"/> <img src="https://drive.google.com/uc?id=1QTA6dB7jnsZfU1kzyUqfD_2V5xODpWFt" alt="" width="200"
style="height:auto;display:block;"/>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -44,26 +45,27 @@
<h1 style="font-size:24px;margin:0 0 20px 0;font-family: 'Roboto', sans-serif; <h1 style="font-size:24px;margin:0 0 20px 0;font-family: 'Roboto', sans-serif;
">Hello, {{ name }}</h1> ">Hello, {{ name }}</h1>
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;"> <p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;">
We have received your application for a <b>{{ application_type }}</b> offer at <b> We have received your application for a <b>{{ application_type }}</b> offer at
{{ company_name }}</b>. <b>
{{ company_name }}</b>.
{% if additional_info_items %} {% if additional_info_items %}
We received these additional details We received these additional details
<br> <br>
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: <p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family:
'Roboto', sans-serif;text-align: center"> 'Roboto', sans-serif;text-align: center">
<table style="border:solid 1px; margin: auto; text-align: center;width: 80%; <table style="border:solid 1px; margin: auto; text-align: center;width: 80%;
border-radius:15px; background-color: #e0e3ee"> border-radius:15px; background-color: #e0e3ee">
{% for i,j in additional_info.items %} {% for i,j in additional_info.items %}
<tr> <tr>
<td style="padding:8px 10px;color:#153643; ">{{ i }}:</td> <td style="padding:8px 10px;color:#153643; ">{{ i }}:</td>
<td style="padding:8px 10px;color:#153643;">{{ j }}</td> <td style="padding:8px 10px;color:#153643;">{{ j }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
{% endif %} {% endif %}
</p> </p>
</p> </p>

View File

@ -32,7 +32,8 @@
style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;"> style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;">
<tr> <tr>
<td align="center" style="padding:40px 0 30px 0;background:#334878;"> <td align="center" style="padding:40px 0 30px 0;background:#334878;">
<img src="https://drive.google.com/uc?id=1QTA6dB7jnsZfU1kzyUqfD_2V5xODpWFt" alt="" width="200" style="height:auto;display:block;"/> <img src="https://drive.google.com/uc?id=1QTA6dB7jnsZfU1kzyUqfD_2V5xODpWFt" alt="" width="200"
style="height:auto;display:block;"/>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -42,10 +43,11 @@
<tr> <tr>
<td style="padding:0 0 36px 0;color:#153643;"> <td style="padding:0 0 36px 0;color:#153643;">
<h1 style="font-size:24px;margin:0 0 20px 0;font-family: 'Roboto', sans-serif; <h1 style="font-size:24px;margin:0 0 20px 0;font-family: 'Roboto', sans-serif;
">{{opening_type}} Opportunity at {{company_name}}</h1> ">{{ opening_type }} Opportunity at {{ company_name }}</h1>
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;"> <p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;">
Gentle reminder for the same. Gentle reminder for the same.
Interested students can apply before <b>{{deadline}}</b> in the <a href="{{link}}">CDC-webportal</a>. Interested students can apply before <b>{{ deadline }}</b> in the <a
href="{{ link }}">CDC-webportal</a>.
</p> </p>
</td> </td>
</tr> </tr>

View File

@ -12,7 +12,7 @@ python# CDC - Backend
4. Install the dependencies <br> 4. Install the dependencies <br>
`pip install -r requirements.txt ` `pip install -r requirements.txt `
5. Ensure that you have the PostgreSQL installed on your machine and is running on PORT **5432** <br> 5. Ensure that you have the PostgreSQL installed on your machine and is running on PORT **5432** <br>
6. Make sure to give the correct database credentials in [settings.py](./CDC_Backend/CDC_Backend/settings.py) 6. Make sure to give the correct database credentials in [settings.py](./CDC_Backend/CDC_Backend/settings.py)
### Running the Application ### Running the Application
@ -35,10 +35,13 @@ python# CDC - Backend
2. Update the `CORS_ORIGIN_WHITELIST` list and `CORS_ORIGIN_ALLOW_ALL` variable 2. Update the `CORS_ORIGIN_WHITELIST` list and `CORS_ORIGIN_ALLOW_ALL` variable
### Starting the Email Server ### Starting the Email Server
Run the following command to start the email backend process <br> Run the following command to start the email backend process <br>
`python manage.py process_tasks` `python manage.py process_tasks`
### API Reference ### API Reference
Check [here](./CDC_Backend/README.md) for Api Reference Check [here](./CDC_Backend/README.md) for Api Reference
For Documentation with Postman Collection, click [here](https://documenter.getpostman.com/view/15531322/UVJfhuhQ#568ad036-ad0e-449a-a26f-4d86616b1393) For Documentation with Postman Collection,
click [here](https://documenter.getpostman.com/view/15531322/UVJfhuhQ#568ad036-ad0e-449a-a26f-4d86616b1393)