From 6e68db7760acc5555d247d2afa0b9f8f546e7258 Mon Sep 17 00:00:00 2001 From: NitinVangipuram Date: Wed, 24 Jul 2024 23:27:27 +0530 Subject: [PATCH 1/2] changes to fields --- CDC_Backend/APIs/companyViews.py | 26 ++++++++++++++++++++------ CDC_Backend/APIs/constants.py | 1 + CDC_Backend/APIs/models.py | 4 ++-- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/CDC_Backend/APIs/companyViews.py b/CDC_Backend/APIs/companyViews.py index 3a44d3f..de5c329 100644 --- a/CDC_Backend/APIs/companyViews.py +++ b/CDC_Backend/APIs/companyViews.py @@ -14,7 +14,7 @@ logger = logging.getLogger('db') IS_COMPENSATION_DETAILS_PDF, ALLOWED_BRANCH, ELIGIBLESTUDENTS, SELECTION_PROCEDURE_ROUNDS, SELECTION_PROCEDURE_DETAILS, IS_SELECTION_PROCEDURE_DETAILS_PDF, TENTATIVE_DATE_OF_JOINING, TENTATIVE_NO_OF_OFFERS, OTHER_REQUIREMENTS, - RECAPTCHA_VALUE, JOB_LOCATION,PSYCHOMETRIC_TEST,MEDICAL_TEST,COMPANY_TURNOVER,NUMBER_OF_EMPLOYEES,BACKLOG_ELIGIBLE,PWD_ELIGIBLE,CPI ,COMPANY_TURNOVER,ESTABLISHMENT_DATE ,EXPECTED_NO_OF_OFFERS]) + RECAPTCHA_VALUE, JOB_LOCATION,PSYCHOMETRIC_TEST,MEDICAL_TEST,NUMBER_OF_EMPLOYEES,BACKLOG_ELIGIBLE,PWD_ELIGIBLE,CPI,EXPECTED_NO_OF_OFFERS]) def addPlacement(request): logger.info("JNF filled by " + str(request.data['email'])) @@ -139,12 +139,17 @@ def addPlacement(request): else: raise ValueError('Compensation CTC must be an integer') # Newly added + if data[COMPANY_TURNOVER].isdigit(): opening.company_turnover = int(data[COMPANY_TURNOVER]) - elif data[COMPANY_TURNOVER] is None: + elif data[COMPANY_TURNOVER] is None or data[COMPANY_TURNOVER] == '': opening.company_turnover = None else: - raise ValueError('Company Turnover must be an integer') + # Handle the case where the data is not a valid number or None/empty + # You can raise an error, set a default value, or log a warning + opening.company_turnover = None # Or some default value or error handling + + # Check if compensation_gross is integer if data[COMPENSATION_GROSS].isdigit(): @@ -455,7 +460,14 @@ def addInternship(request): raise ValueError('Season must be a subset of ' + str(SEASONS)) internship.interning_period_from = datetime.datetime.strptime(data[START_DATE], '%d-%m-%Y').date() internship.interning_period_to = datetime.datetime.strptime(data[END_DATE], '%d-%m-%Y').date() - internship.establishment_date = datetime.datetime.strptime(data[ESTABLISHMENT_DATE], '%d-%m-%Y').date() # newly added field + establishment_date_str = data.get('ESTABLISHMENT_DATE', '') + if establishment_date_str: + try: + internship.establishment_date = datetime.datetime.strptime(establishment_date_str, '%d-%m-%Y').date() + except ValueError: + internship.establishment_date = None + else: + internship.establishment_date = None if data[WORK_TYPE] == 'Work from home': internship.is_work_from_home = True else: @@ -529,10 +541,12 @@ def addInternship(request): # Newly added if data[COMPANY_TURNOVER].isdigit(): internship.company_turnover = int(data[COMPANY_TURNOVER]) - elif data[COMPANY_TURNOVER] is None: + elif data[COMPANY_TURNOVER] is None or data[COMPANY_TURNOVER] == '': internship.company_turnover = None else: - raise ValueError('Company Turnover must be an integer') + # Handle the case where the data is not a valid number or None/empty + # You can raise an error, set a default value, or log a warning + internship.company_turnover = None # Or some default value or error handling # newly added if data[EXPECTED_NO_OF_OFFERS].isdigit(): internship.expected_no_of_offers = int(data[EXPECTED_NO_OF_OFFERS]) diff --git a/CDC_Backend/APIs/constants.py b/CDC_Backend/APIs/constants.py index bc4fa72..4bb9152 100644 --- a/CDC_Backend/APIs/constants.py +++ b/CDC_Backend/APIs/constants.py @@ -32,6 +32,7 @@ ELIGIBLE =[ "MS", "MTech", "PHD", + "BSMS", ] BATCHES = [ #change it accordingly "2023", diff --git a/CDC_Backend/APIs/models.py b/CDC_Backend/APIs/models.py index 74c4627..427b25b 100644 --- a/CDC_Backend/APIs/models.py +++ b/CDC_Backend/APIs/models.py @@ -109,7 +109,7 @@ class Placement(models.Model): blank=True) is_description_pdf = models.BooleanField(blank=False, default=False) compensation_CTC = models.IntegerField(blank=False, default=None, null=True) # Job - Per Year - company_turnover = models.IntegerField(blank=False, default=None, null=True) # newly added field + company_turnover = models.IntegerField(blank=True, default=None, null=True) # newly added field 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) @@ -142,7 +142,7 @@ class Placement(models.Model): ) tentative_no_of_offers = models.IntegerField(blank=False, default=None, null=True) expected_no_of_offers = models.IntegerField(blank=False , default=None , null=True) # newly added - number_of_employees = models.IntegerField(blank=False, default=None, null=True) # newly added field + number_of_employees = models.IntegerField(blank=True, default=None, null=True) # newly added field eligiblestudents = ArrayField( models.CharField(choices=ELIGIBLE_CHOICES, blank=False, max_length=10), size=10, From 93b716ec90ec83dfa41349e87152145082e6a7a8 Mon Sep 17 00:00:00 2001 From: NitinVangipuram Date: Thu, 25 Jul 2024 12:25:49 +0530 Subject: [PATCH 2/2] changes to templates --- CDC_Backend/APIs/companyViews.py | 13 +- CDC_Backend/APIs/constants.py | 4 +- .../templates/company_email_verification.html | 313 ++++++++++------- .../templates/company_jnf_response.html | 10 +- .../templates/company_opening_submitted.html | 294 +++++++++------- CDC_Backend/templates/images/Approved.png | Bin 190261 -> 0 bytes CDC_Backend/templates/images/CDC-Logo.png | Bin 167511 -> 0 bytes CDC_Backend/templates/images/Confirmed.png | Bin 6307 -> 0 bytes .../templates/images/Instagram_icon.png | Bin 1335709 -> 0 bytes .../images/LinkedIn_logo_initials.png | Bin 10309 -> 0 bytes CDC_Backend/templates/images/Rejected.png | Bin 9028 -> 0 bytes .../templates/images/email_2058176.png | Bin 18946 -> 0 bytes CDC_Backend/templates/images/image3.jpg | Bin 98181 -> 0 bytes CDC_Backend/templates/images/message.png | Bin 19684 -> 0 bytes CDC_Backend/templates/images/mobile.png | Bin 41483 -> 0 bytes CDC_Backend/templates/images/notification.png | Bin 15294 -> 0 bytes CDC_Backend/templates/images/reminder.png | Bin 23575 -> 0 bytes CDC_Backend/templates/images/tracking.png | Bin 25865 -> 0 bytes CDC_Backend/templates/images/twitter.png | Bin 4696 -> 0 bytes .../notify_students_new_opening.html | 10 +- .../templates/reps_issue_submitted.html | 328 +++++++++-------- ...udent_application_status_not_selected.html | 299 +++++++++------- .../student_application_status_selected.html | 293 +++++++++------- .../student_application_submitted.html | 329 ++++++++++-------- .../student_application_updated.html | 329 ++++++++++-------- .../templates/student_issue_submitted.html | 10 +- .../templates/students_opening_reminder.html | 10 +- 27 files changed, 1288 insertions(+), 954 deletions(-) delete mode 100644 CDC_Backend/templates/images/Approved.png delete mode 100644 CDC_Backend/templates/images/CDC-Logo.png delete mode 100644 CDC_Backend/templates/images/Confirmed.png delete mode 100644 CDC_Backend/templates/images/Instagram_icon.png delete mode 100644 CDC_Backend/templates/images/LinkedIn_logo_initials.png delete mode 100644 CDC_Backend/templates/images/Rejected.png delete mode 100644 CDC_Backend/templates/images/email_2058176.png delete mode 100644 CDC_Backend/templates/images/image3.jpg delete mode 100644 CDC_Backend/templates/images/message.png delete mode 100644 CDC_Backend/templates/images/mobile.png delete mode 100644 CDC_Backend/templates/images/notification.png delete mode 100644 CDC_Backend/templates/images/reminder.png delete mode 100644 CDC_Backend/templates/images/tracking.png delete mode 100644 CDC_Backend/templates/images/twitter.png diff --git a/CDC_Backend/APIs/companyViews.py b/CDC_Backend/APIs/companyViews.py index de5c329..6774a13 100644 --- a/CDC_Backend/APIs/companyViews.py +++ b/CDC_Backend/APIs/companyViews.py @@ -232,8 +232,14 @@ def addPlacement(request): # Convert to date object opening.tentative_date_of_joining = datetime.datetime.strptime(data[TENTATIVE_DATE_OF_JOINING], '%d-%m-%Y').date() - opening.establishment_date = datetime.datetime.strptime(data[ESTABLISHMENT_DATE], - '%d-%m-%Y').date() # newly added field + establishment_date_str = data.get('ESTABLISHMENT_DATE', '') + if establishment_date_str: + try: + opening.establishment_date = datetime.datetime.strptime(establishment_date_str, '%d-%m-%Y').date() + except ValueError: + opening.establishment_date = None + else: + opening.establishment_date = None # Only Allowing Fourth Year for Placement opening.allowed_batch = [FOURTH_YEAR,] @@ -471,8 +477,7 @@ def addInternship(request): if data[WORK_TYPE] == 'Work from home': internship.is_work_from_home = True else: - internship.is_work_from_home = False - + internship.is_work_from_home = False if ALLOWED_BATCH in data and (data[ALLOWED_BATCH] is None or json.loads(data[ALLOWED_BATCH]) == ""): raise ValueError('Allowed Batches cannot be empty') elif ALLOWED_BATCH in data and set(json.loads(data[ALLOWED_BATCH])).issubset(BATCHES): diff --git a/CDC_Backend/APIs/constants.py b/CDC_Backend/APIs/constants.py index 4bb9152..ed2bfaf 100644 --- a/CDC_Backend/APIs/constants.py +++ b/CDC_Backend/APIs/constants.py @@ -10,13 +10,13 @@ BRANCH_CHOICES = [ ['EP', 'EP'], ['CIVIL', 'CIVIL'], ['CHEMICAL', 'CHEMICAL'], - ['BSMS', 'BSMS'], ] ELIGIBLE_CHOICES = [ ["Btech", "Btech"], ["MS", "MS"], ["MTech", "MTech"], ["PHD", "PHD"], + ["BSMS", "BSMS"], ] BRANCHES = [ "CSE", @@ -25,7 +25,7 @@ BRANCHES = [ "EP", "CIVIL", "CHEMICAL", - "BSMS", + "MNC", ] ELIGIBLE =[ "Btech", diff --git a/CDC_Backend/templates/company_email_verification.html b/CDC_Backend/templates/company_email_verification.html index 9c12f7e..8bd9b3a 100644 --- a/CDC_Backend/templates/company_email_verification.html +++ b/CDC_Backend/templates/company_email_verification.html @@ -1,137 +1,196 @@ - - - - + + + + Email Template - - - + + + - - + + - + diff --git a/CDC_Backend/templates/company_jnf_response.html b/CDC_Backend/templates/company_jnf_response.html index 9c12dd7..6003baf 100644 --- a/CDC_Backend/templates/company_jnf_response.html +++ b/CDC_Backend/templates/company_jnf_response.html @@ -118,12 +118,12 @@