From 20a570e8420d0a927a11f23467c08b4aa801c87d Mon Sep 17 00:00:00 2001 From: gowtham Date: Mon, 2 May 2022 17:16:56 +0530 Subject: [PATCH] Reformatted Code and Optimized Imports --- CDC_Backend/APIs/admin.py | 23 +++-- CDC_Backend/APIs/adminUrls.py | 2 +- CDC_Backend/APIs/adminViews.py | 2 +- CDC_Backend/APIs/companyUrls.py | 2 +- CDC_Backend/APIs/companyViews.py | 2 - CDC_Backend/APIs/constants.py | 9 +- CDC_Backend/APIs/models.py | 29 ++++-- CDC_Backend/APIs/serializers.py | 3 +- CDC_Backend/APIs/studentUrls.py | 4 +- CDC_Backend/APIs/studentViews.py | 7 +- CDC_Backend/APIs/tests.py | 2 - CDC_Backend/APIs/urls.py | 1 + CDC_Backend/APIs/utils.py | 34 ++++--- CDC_Backend/CDC_Backend/settings.py | 1 + CDC_Backend/README.md | 4 - ...4t1qcp.apps.googleusercontent.com (2).json | 8 +- .../templates/company_email_verification.html | 6 +- .../templates/company_jnf_response.html | 96 +++++++++++-------- .../templates/company_opening_submitted.html | 48 ++++++---- .../notify_students_new_opening.html | 12 ++- ...udent_application_status_not_selected.html | 6 +- .../student_application_status_selected.html | 6 +- .../student_application_submitted.html | 32 ++++--- .../templates/students_opening_reminder.html | 10 +- README.md | 7 +- 25 files changed, 206 insertions(+), 150 deletions(-) diff --git a/CDC_Backend/APIs/admin.py b/CDC_Backend/APIs/admin.py index 3f5bb08..e2a87c3 100644 --- a/CDC_Backend/APIs/admin.py +++ b/CDC_Backend/APIs/admin.py @@ -1,17 +1,14 @@ 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.shortcuts import resolve_url from django.utils.html import format_html from django.utils.safestring import SafeText + from .models import * admin.site.register(User) admin.site.register(Admin) - - admin.site.site_header = "CDC Recruitment Portal" @@ -22,10 +19,21 @@ def model_admin_url(obj, name=None) -> str: @admin.register(Student) class Student(admin.ModelAdmin): - list_display = ("roll_no", "name", "batch", "branch", "phone_number") - search_fields = ("roll_no", "name","phone_number") + list_display = ("roll_no", "name", "batch", "branch", "phone_number", 'can_apply') + search_fields = ("roll_no", "name", "phone_number") ordering = ("roll_no", "name", "batch", "branch", "phone_number") 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) @@ -52,11 +60,10 @@ class PlacementApplication(admin.ModelAdmin): @admin.register(PrePlacementOffer) class PrePlacementOffer(admin.ModelAdmin): - list_display = ('company', 'Student', 'accepted') + list_display = ('company', 'Student', 'accepted') search_fields = ('company',) ordering = ('company',) list_filter = ('accepted',) def Student(self, obj): return model_admin_url(obj.student) - diff --git a/CDC_Backend/APIs/adminUrls.py b/CDC_Backend/APIs/adminUrls.py index d99c3e6..71d0073 100644 --- a/CDC_Backend/APIs/adminUrls.py +++ b/CDC_Backend/APIs/adminUrls.py @@ -1,6 +1,6 @@ from django.urls import path -from . import adminViews +from . import adminViews urlpatterns = [ path('markStatus/', adminViews.markStatus, name="Mark Status"), diff --git a/CDC_Backend/APIs/adminViews.py b/CDC_Backend/APIs/adminViews.py index 4aeae91..e01d26e 100644 --- a/CDC_Backend/APIs/adminViews.py +++ b/CDC_Backend/APIs/adminViews.py @@ -1,5 +1,4 @@ import csv -import json 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"}, status=status.HTTP_400_BAD_REQUEST) + @api_view(['POST']) @isAuthorized(allowed_users=[ADMIN]) @precheck(required_data=[COMPANY_NAME, COMPENSATION_GROSS, OFFER_ACCEPTED, STUDENT_ID, DESIGNATION, TIER]) diff --git a/CDC_Backend/APIs/companyUrls.py b/CDC_Backend/APIs/companyUrls.py index 525a585..4db1c55 100644 --- a/CDC_Backend/APIs/companyUrls.py +++ b/CDC_Backend/APIs/companyUrls.py @@ -1,6 +1,6 @@ from django.urls import path -from . import companyViews +from . import companyViews urlpatterns = [ path('addPlacement/', companyViews.addPlacement, name="Add Placement"), diff --git a/CDC_Backend/APIs/companyViews.py b/CDC_Backend/APIs/companyViews.py index 503b6d3..6d4d041 100644 --- a/CDC_Backend/APIs/companyViews.py +++ b/CDC_Backend/APIs/companyViews.py @@ -1,7 +1,5 @@ from rest_framework.decorators import api_view -from django.forms.models import model_to_dict -from .models import * from .utils import * logger = logging.getLogger('db') diff --git a/CDC_Backend/APIs/constants.py b/CDC_Backend/APIs/constants.py index 33a9952..1a3b813 100644 --- a/CDC_Backend/APIs/constants.py +++ b/CDC_Backend/APIs/constants.py @@ -39,7 +39,7 @@ TOTAL_BATCHES = 4 # Total No of Batches CLIENT_ID = "956830229554-290mirc16pdhd5j7ph7v7ukibo4t1qcp.apps.googleusercontent.com" # Google Login Client ID # 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_RESUME = "http://localhost/storage/Resumes/" LINK_TO_APPLICATIONS_CSV = "http://localhost/storage/Application_CSV/" @@ -54,8 +54,7 @@ TIER = 'tier' # To be Configured Properly FOURTH_YEAR = '2019' 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_COMPANY_ATTACHMENTS = './Storage/Company_Attachments/' @@ -88,7 +87,6 @@ STATE = 'state' COUNTRY = 'country' PINCODE = 'pincode' - DESIGNATION = 'designation' DESCRIPTION = 'description' DESCRIPTION_PDF = 'description_pdf' @@ -123,7 +121,6 @@ STUDENT_LIST = "student_list" STUDENT_ID = "student_id" STUDENT_SELECTED = "student_selected" - 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_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', '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 diff --git a/CDC_Backend/APIs/models.py b/CDC_Backend/APIs/models.py index 5ab67ff..8857cf8 100644 --- a/CDC_Backend/APIs/models.py +++ b/CDC_Backend/APIs/models.py @@ -1,15 +1,18 @@ from django.contrib.postgres.fields import ArrayField from django.db import models from django.utils import timezone -from .constants import * -# from .utils import * +from .constants import * + + +# from .utils import * class User(models.Model): email = models.CharField(primary_key=True, blank=False, max_length=50) id = models.CharField(blank=False, max_length=25) 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): @@ -21,7 +24,7 @@ class Student(models.Model): 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) 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): return str(self.roll_no) @@ -45,7 +48,8 @@ class Placement(models.Model): nature_of_business = models.CharField(blank=False, max_length=50, default="") website = models.CharField(blank=True, max_length=50) 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) contact_person_name = models.CharField(blank=False, max_length=50) phone_number = models.PositiveBigIntegerField(blank=False) @@ -53,24 +57,28 @@ class Placement(models.Model): city = 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="") - 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) # Job Details 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_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) - 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_take_home = models.IntegerField(blank=False, 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_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) 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_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) 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) @@ -103,6 +111,7 @@ class Placement(models.Model): def __str__(self): return self.company_name + " - " + self.id + class PlacementApplication(models.Model): 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) diff --git a/CDC_Backend/APIs/serializers.py b/CDC_Backend/APIs/serializers.py index b0296a2..82af184 100644 --- a/CDC_Backend/APIs/serializers.py +++ b/CDC_Backend/APIs/serializers.py @@ -1,6 +1,7 @@ import urllib from rest_framework import serializers + 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, COMPENSATION_DETAILS_PDF_NAMES, SELECTION_PROCEDURE_DETAILS_PDF_NAMES, OFFER_ACCEPTED, EMAIL_VERIFIED, - ] + ] depth = 1 diff --git a/CDC_Backend/APIs/studentUrls.py b/CDC_Backend/APIs/studentUrls.py index 1d6d76a..f532849 100644 --- a/CDC_Backend/APIs/studentUrls.py +++ b/CDC_Backend/APIs/studentUrls.py @@ -1,6 +1,6 @@ -from django.urls import path, include -from . import studentViews +from django.urls import path +from . import studentViews urlpatterns = [ path('login/', studentViews.login, name="Login"), diff --git a/CDC_Backend/APIs/studentViews.py b/CDC_Backend/APIs/studentViews.py index ed8f4f1..daf4221 100644 --- a/CDC_Backend/APIs/studentViews.py +++ b/CDC_Backend/APIs/studentViews.py @@ -1,8 +1,3 @@ -import json -# from datetime import datetime -import datetime -import traceback - from rest_framework.decorators import api_view from .serializers import * @@ -75,7 +70,7 @@ def getDashboard(request, id, email, user_type): placements = Placement.objects.filter(allowed_batch__contains=[studentDetails.batch], allowed_branch__contains=[studentDetails.branch], 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 placementApplications = PlacementApplication.objects.filter(student_id=id) placementApplications = PlacementApplicationSerializer(placementApplications, many=True).data diff --git a/CDC_Backend/APIs/tests.py b/CDC_Backend/APIs/tests.py index 7ce503c..a39b155 100644 --- a/CDC_Backend/APIs/tests.py +++ b/CDC_Backend/APIs/tests.py @@ -1,3 +1 @@ -from django.test import TestCase - # Create your tests here. diff --git a/CDC_Backend/APIs/urls.py b/CDC_Backend/APIs/urls.py index bdb06c8..36f929e 100644 --- a/CDC_Backend/APIs/urls.py +++ b/CDC_Backend/APIs/urls.py @@ -1,4 +1,5 @@ from django.urls import path, include + from . import studentViews, studentUrls, companyUrls, adminUrls urlpatterns = [ diff --git a/CDC_Backend/APIs/utils.py b/CDC_Backend/APIs/utils.py index 6ffbc9f..d98f045 100644 --- a/CDC_Backend/APIs/utils.py +++ b/CDC_Backend/APIs/utils.py @@ -1,4 +1,5 @@ import datetime +import json import logging import os import random @@ -7,9 +8,11 @@ import string import sys import traceback from os import path, remove -import json + import background_task import jwt +import pdfkit +import requests as rq from django.conf import settings from django.core.mail import EmailMultiAlternatives 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 rest_framework import status from rest_framework.response import Response -import requests as rq -import pdfkit from .constants import * from .models import User, PrePlacementOffer, PlacementApplication, Placement @@ -78,7 +79,8 @@ def isAuthorized(allowed_users=None): print(email) user = get_object_or_404(User, email=email) if user: - + user.last_login_time = datetime.datetime.now() + user.save() 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) else: @@ -150,7 +152,8 @@ def sendEmail(email_to, subject, data, template, attachment_jnf_respone=None): msg.attach_alternative(html_content, "text/html") if 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.send() return True @@ -248,6 +251,7 @@ def generateOneTimeVerificationLink(email, opening_id, opening_type): logger.warning("Utils - generateOneTimeVerificationLink: " + str(sys.exc_info())) return False, "_" + def verify_recaptcha(request): try: print(settings.RECAPTCHA_SECRET_KEY) @@ -269,19 +273,25 @@ def verify_recaptcha(request): logger.warning("Utils - verify_recaptcha: " + str(sys.exc_info())) return False, "_" + 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()) newdetails = {} for key in keys: if isinstance(details[key], 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': details[key] = {"details": details[key], "type": ["link"]} else: - details[key] = {"details": details[key]["details"], "type": ["list","link"], "link": PDF_FILES_SERVING_ENDPOINT+opening.id+"/"} - new_key = key.replace('_',' ') + details[key] = {"details": details[key]["details"], "type": ["list", "link"], + "link": PDF_FILES_SERVING_ENDPOINT + opening.id + "/"} + new_key = key.replace('_', ' ') if key.endswith(' names'): new_key = key[:-6] new_key = new_key.capitalize() @@ -289,7 +299,7 @@ def opening_description_table_html(opening): imagepath = os.path.abspath('./templates/image.png') print(imagepath) data = { - "data": newdetails, - "imgpath": imagepath + "data": newdetails, + "imgpath": imagepath } - return render_to_string(COMPANY_JNF_RESPONSE_TEMPLATE, data) \ No newline at end of file + return render_to_string(COMPANY_JNF_RESPONSE_TEMPLATE, data) diff --git a/CDC_Backend/CDC_Backend/settings.py b/CDC_Backend/CDC_Backend/settings.py index 9a09b88..4c24f27 100644 --- a/CDC_Backend/CDC_Backend/settings.py +++ b/CDC_Backend/CDC_Backend/settings.py @@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/2.2/ref/settings/ """ import os + from dotenv import load_dotenv load_dotenv("../dev.env") diff --git a/CDC_Backend/README.md b/CDC_Backend/README.md index 6a041f0..30c06d8 100644 --- a/CDC_Backend/README.md +++ b/CDC_Backend/README.md @@ -158,7 +158,6 @@ Request_Body: > Only users with `student` role can access this Api. - ### Response Response is a Json with these fields @@ -565,8 +564,6 @@ Request_Body: } ``` - - > Headers
> 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. - previous: Gives us the list of placements that stopped accepting applications. - ### Status Codes The possible responses for this api request are as follows diff --git a/CDC_Backend/client_secret_956830229554-290mirc16pdhd5j7ph7v7ukibo4t1qcp.apps.googleusercontent.com (2).json b/CDC_Backend/client_secret_956830229554-290mirc16pdhd5j7ph7v7ukibo4t1qcp.apps.googleusercontent.com (2).json index 42f9eb6..51b5c1c 100644 --- a/CDC_Backend/client_secret_956830229554-290mirc16pdhd5j7ph7v7ukibo4t1qcp.apps.googleusercontent.com (2).json +++ b/CDC_Backend/client_secret_956830229554-290mirc16pdhd5j7ph7v7ukibo4t1qcp.apps.googleusercontent.com (2).json @@ -6,7 +6,11 @@ "token_uri": "https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_secret": "ZzvcweJylL1IDLUnYOi1ws2W", - "redirect_uris": ["https://www.getpostman.com/oauth2/callback"], - "javascript_origins": ["http://localhost:3000"] + "redirect_uris": [ + "https://www.getpostman.com/oauth2/callback" + ], + "javascript_origins": [ + "http://localhost:3000" + ] } } diff --git a/CDC_Backend/templates/company_email_verification.html b/CDC_Backend/templates/company_email_verification.html index e3f480a..e4b6b19 100644 --- a/CDC_Backend/templates/company_email_verification.html +++ b/CDC_Backend/templates/company_email_verification.html @@ -32,7 +32,8 @@ style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;"> - + @@ -43,7 +44,8 @@

- We have received your Job Notification. Kindly verify your email by clicking here. + We have received your Job Notification. Kindly verify your email by clicking here.

diff --git a/CDC_Backend/templates/company_jnf_response.html b/CDC_Backend/templates/company_jnf_response.html index e8b23c5..93fd488 100644 --- a/CDC_Backend/templates/company_jnf_response.html +++ b/CDC_Backend/templates/company_jnf_response.html @@ -5,57 +5,69 @@ Document - -
cdc logo
-

Job Notification Form Response

- - {% for key, value in data.items %} - - - - - {% endfor %} -
- {{ key }} - - {% if 'list' in value.type %} - - {% for item in value.details %} -
  • - {% if 'link' in value.type and value.link %} - {{ item }} - {% elif 'link' in value.type %} - {{ item }} - {% else %} - {{ item }} - {% endif %} -
  • - {% endfor %} - {% else %} - {% if 'link' in value.type %} - {{ value.details }} - {% else %} - {{ value }} - {% endif %} - {% endif %} - -
    -

    In case of any descripency regarding above details, please contact cdc@iitdh.ac.in -

    +
    cdc logo
    +

    Job Notification Form Response

    + + {% for key, value in data.items %} + + + + + {% endfor %} +
    + {{ key }} + + {% if 'list' in value.type %} + + {% for item in value.details %} +
  • + {% if 'link' in value.type and value.link %} + {{ item }} + {% elif 'link' in value.type %} + {{ item }} + {% else %} + {{ item }} + {% endif %} +
  • + {% endfor %} + {% else %} + {% if 'link' in value.type %} + {{ value.details }} + {% else %} + {{ value }} + {% endif %} + {% endif %} + +
    +

    In case of any descripency regarding above details, please contact cdc@iitdh.ac.in + +

    diff --git a/CDC_Backend/templates/company_opening_submitted.html b/CDC_Backend/templates/company_opening_submitted.html index 31d6214..aab48dc 100644 --- a/CDC_Backend/templates/company_opening_submitted.html +++ b/CDC_Backend/templates/company_opening_submitted.html @@ -21,10 +21,20 @@ table, td, div, h1, p { font-family: 'Roboto', sans-serif; } - #details_table tr:nth-child(even) {background: #FFF} - #details_table tr:nth-child(odd) {background: #f9f9f9} - #details_table td {padding: 10px} - #details_table{ + + #details_table tr:nth-child(even) { + background: #FFF + } + + #details_table tr:nth-child(odd) { + background: #f9f9f9 + } + + #details_table td { + padding: 10px + } + + #details_table { border: #334878 1px solid; border-collapse: collapse; } @@ -40,7 +50,8 @@ style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;"> - + @@ -52,8 +63,10 @@

    Thank You for filling the form

    - We have received your {{ opening_type }} notification for a {{ designation }} offer at - {{ company_name }}. Click here to view your notification. + We have received your {{ opening_type }} notification for a + {{ designation }} offer at + {{ company_name }}. Click here to view your + notification.

    We will keep you informed with the updates. If you have any queries, please @@ -64,30 +77,30 @@ {% for key, value in data.items %} - @@ -111,7 +124,6 @@ -
    - {{ key }} + + {{ key }} {% if 'list' in value.type %} - {% for item in value.details %} + {% for item in value.details %}
  • {% if 'link' in value.type and value.link %} - {{ item }} + {{ item }} {% elif 'link' in value.type %} - {{ item }} + {{ item }} {% else %} - {{ item }} + {{ item }} {% endif %}
  • - {% endfor %} + {% endfor %} {% else %} {% if 'link' in value.type %} - {{ value.details }} + {{ value.details }} {% else %} - {{ value }} + {{ value }} {% endif %} - {% endif %} + {% endif %}
    diff --git a/CDC_Backend/templates/notify_students_new_opening.html b/CDC_Backend/templates/notify_students_new_opening.html index 96d4e64..9193f0d 100644 --- a/CDC_Backend/templates/notify_students_new_opening.html +++ b/CDC_Backend/templates/notify_students_new_opening.html @@ -32,7 +32,8 @@ style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;"> - + @@ -42,17 +43,19 @@

    {{opening_type}} Opportunity at {{company_name}}

    +">{{ opening_type }} Opportunity at {{ company_name }}

    Greetings of the day. Hope you are fine and doing well !

    - CDC is excited to announce that {{company_name}} is interested in recruiting {{designation}} from IIT Dharwad. + CDC is excited to announce that {{ company_name }} is interested in + recruiting {{ designation }} from IIT Dharwad. More details can be found in the CDC-webportal.

    - Interested students can apply before {{deadline}} in the CDC-webportal. + Interested students can apply before {{ deadline }} in the CDC-webportal.

    @@ -72,7 +75,6 @@ - diff --git a/CDC_Backend/templates/student_application_status_not_selected.html b/CDC_Backend/templates/student_application_status_not_selected.html index 4adcd2d..d56fd84 100644 --- a/CDC_Backend/templates/student_application_status_not_selected.html +++ b/CDC_Backend/templates/student_application_status_not_selected.html @@ -31,7 +31,8 @@ style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;"> - + @@ -43,7 +44,8 @@

    Hey, {{ student_name }}

    - We regret to inform you that you have not been selected for {{ designation }} role at {{ company_name }}. + We regret to inform you that you have not been selected for + {{ designation }} role at {{ company_name }}. CDC will keep bringing more such opportunities for you in the future. diff --git a/CDC_Backend/templates/student_application_status_selected.html b/CDC_Backend/templates/student_application_status_selected.html index 608268a..806dfe3 100644 --- a/CDC_Backend/templates/student_application_status_selected.html +++ b/CDC_Backend/templates/student_application_status_selected.html @@ -31,7 +31,8 @@ style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;"> - + @@ -43,7 +44,8 @@

    Hey, {{ student_name }}

    - Congratulations, You have been selected for the {{ designation }} at {{ company_name }}.
    + Congratulations, You have been selected for the {{ designation }} at + {{ company_name }}.
    diff --git a/CDC_Backend/templates/student_application_submitted.html b/CDC_Backend/templates/student_application_submitted.html index 87de410..68a9e26 100644 --- a/CDC_Backend/templates/student_application_submitted.html +++ b/CDC_Backend/templates/student_application_submitted.html @@ -32,7 +32,8 @@ style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;"> - + @@ -44,26 +45,27 @@

    Hello, {{ name }}

    - We have received your application for a {{ application_type }} offer at - {{ company_name }}. + We have received your application for a {{ application_type }} offer at + + {{ company_name }}. {% if additional_info_items %} - We received these additional details -
    -

    - - {% for i,j in additional_info.items %} + {% for i,j in additional_info.items %} - - - - - {% endfor %} -
    {{ i }}:{{ j }}
    - {% endif %} + + {{ i }}: + {{ j }} + + {% endfor %} + + {% endif %}

    diff --git a/CDC_Backend/templates/students_opening_reminder.html b/CDC_Backend/templates/students_opening_reminder.html index e6fa9ed..4541089 100644 --- a/CDC_Backend/templates/students_opening_reminder.html +++ b/CDC_Backend/templates/students_opening_reminder.html @@ -32,7 +32,8 @@ style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;"> - + @@ -42,10 +43,11 @@

    {{opening_type}} Opportunity at {{company_name}}

    +">{{ opening_type }} Opportunity at {{ company_name }}

    - Gentle reminder for the same. - Interested students can apply before {{deadline}} in the CDC-webportal. + Gentle reminder for the same. + Interested students can apply before {{ deadline }} in the CDC-webportal.

    diff --git a/README.md b/README.md index 78a53cf..83ac1d8 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ python# CDC - Backend 4. Install the dependencies
    `pip install -r requirements.txt ` 5. Ensure that you have the PostgreSQL installed on your machine and is running on PORT **5432**
    -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 @@ -35,10 +35,13 @@ python# CDC - Backend 2. Update the `CORS_ORIGIN_WHITELIST` list and `CORS_ORIGIN_ALLOW_ALL` variable ### Starting the Email Server + Run the following command to start the email backend process
    `python manage.py process_tasks` + ### 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)