remove recaptcha and added new jnf fields
This commit is contained in:
parent
c31ac2e6f3
commit
5412aef50e
|
@ -11,10 +11,11 @@ logger = logging.getLogger('db')
|
||||||
IS_COMPANY_DETAILS_PDF, CONTACT_PERSON_NAME, PHONE_NUMBER, EMAIL, CITY, STATE, COUNTRY, PINCODE, DESIGNATION,
|
IS_COMPANY_DETAILS_PDF, CONTACT_PERSON_NAME, PHONE_NUMBER, EMAIL, CITY, STATE, COUNTRY, PINCODE, DESIGNATION,
|
||||||
DESCRIPTION,
|
DESCRIPTION,
|
||||||
IS_DESCRIPTION_PDF, COMPENSATION_CTC, COMPENSATION_GROSS, COMPENSATION_TAKE_HOME, COMPENSATION_BONUS,
|
IS_DESCRIPTION_PDF, COMPENSATION_CTC, COMPENSATION_GROSS, COMPENSATION_TAKE_HOME, COMPENSATION_BONUS,
|
||||||
IS_COMPENSATION_DETAILS_PDF, ALLOWED_BRANCH, RS_ELIGIBLE, SELECTION_PROCEDURE_ROUNDS,
|
IS_COMPENSATION_DETAILS_PDF, BTECH_ALLOWED, MTECH_ALLOWED, MS_ALLOWED, PHD_ALLOWED,
|
||||||
SELECTION_PROCEDURE_DETAILS,
|
BTECH_BRANCH, MTECH_BRANCH, MS_BRANCH, PHD_BRANCH,
|
||||||
|
SELECTION_PROCEDURE_ROUNDS, SELECTION_PROCEDURE_DETAILS,
|
||||||
IS_SELECTION_PROCEDURE_DETAILS_PDF, TENTATIVE_DATE_OF_JOINING, TENTATIVE_NO_OF_OFFERS, OTHER_REQUIREMENTS,
|
IS_SELECTION_PROCEDURE_DETAILS_PDF, TENTATIVE_DATE_OF_JOINING, TENTATIVE_NO_OF_OFFERS, OTHER_REQUIREMENTS,
|
||||||
RECAPTCHA_VALUE, JOB_LOCATION
|
JOB_LOCATION
|
||||||
])
|
])
|
||||||
def addPlacement(request):
|
def addPlacement(request):
|
||||||
logger.info("JNF filled by " + str(request.data['email']))
|
logger.info("JNF filled by " + str(request.data['email']))
|
||||||
|
@ -23,8 +24,6 @@ def addPlacement(request):
|
||||||
data = request.data
|
data = request.data
|
||||||
files = request.FILES
|
files = request.FILES
|
||||||
opening = Placement()
|
opening = Placement()
|
||||||
if not verify_recaptcha(data[RECAPTCHA_VALUE]):
|
|
||||||
raise Exception("Recaptcha Failed")
|
|
||||||
|
|
||||||
opening.id = generateRandomString()
|
opening.id = generateRandomString()
|
||||||
# Add a company details in the opening
|
# Add a company details in the opening
|
||||||
|
@ -36,10 +35,6 @@ def addPlacement(request):
|
||||||
opening.website = data[WEBSITE]
|
opening.website = data[WEBSITE]
|
||||||
opening.company_details = data[COMPANY_DETAILS]
|
opening.company_details = data[COMPANY_DETAILS]
|
||||||
opening.is_company_details_pdf = data[IS_COMPANY_DETAILS_PDF]
|
opening.is_company_details_pdf = data[IS_COMPANY_DETAILS_PDF]
|
||||||
if data[RS_ELIGIBLE] == 'Yes':
|
|
||||||
opening.rs_eligible = True
|
|
||||||
else:
|
|
||||||
opening.rs_eligible = False
|
|
||||||
|
|
||||||
if opening.is_company_details_pdf:
|
if opening.is_company_details_pdf:
|
||||||
company_details_pdf = []
|
company_details_pdf = []
|
||||||
|
@ -198,13 +193,19 @@ def addPlacement(request):
|
||||||
|
|
||||||
# Only Allowing Fourth Year for Placement
|
# Only Allowing Fourth Year for Placement
|
||||||
opening.allowed_batch = [FOURTH_YEAR,]
|
opening.allowed_batch = [FOURTH_YEAR,]
|
||||||
# Check if allowed_branch are valid
|
opening.btech_allowed = data[BTECH_ALLOWED] == "true"
|
||||||
if data[ALLOWED_BRANCH] is None:
|
opening.mtech_allowed = data[MTECH_ALLOWED] == "true"
|
||||||
raise ValueError('Allowed Branch cannot be empty')
|
opening.ms_allowed = data[MS_ALLOWED] == "true"
|
||||||
elif set(json.loads(data[ALLOWED_BRANCH])).issubset(BRANCHES):
|
opening.phd_allowed = data[PHD_ALLOWED] == "true"
|
||||||
opening.allowed_branch = json.loads(data[ALLOWED_BRANCH])
|
|
||||||
else:
|
if opening.btech_allowed:
|
||||||
raise ValueError('Allowed Branch must be a subset of ' + str(BRANCHES))
|
opening.btech_allowed_branch = json.loads(data[BTECH_BRANCH])
|
||||||
|
if opening.mtech_allowed:
|
||||||
|
opening.mtech_allowed_branch = json.loads(data[MTECH_BRANCH])
|
||||||
|
if opening.ms_allowed:
|
||||||
|
opening.ms_allowed_branch = json.loads(data[MS_BRANCH])
|
||||||
|
if opening.phd_allowed:
|
||||||
|
opening.phd_allowed_branch = json.loads(data[PHD_BRANCH])
|
||||||
|
|
||||||
# Check if tentative_no_of_offers is integer
|
# Check if tentative_no_of_offers is integer
|
||||||
if data[TENTATIVE_NO_OF_OFFERS].isdigit():
|
if data[TENTATIVE_NO_OF_OFFERS].isdigit():
|
||||||
|
@ -352,7 +353,7 @@ def autoFillInf(request):
|
||||||
ALLOWED_BRANCH, SOPHOMORES_ELIIGIBLE, RS_ELIGIBLE, NUM_OFFERS, IS_STIPEND_DETAILS_PDF, STIPEND,
|
ALLOWED_BRANCH, SOPHOMORES_ELIIGIBLE, RS_ELIGIBLE, NUM_OFFERS, IS_STIPEND_DETAILS_PDF, STIPEND,
|
||||||
FACILITIES, OTHER_FACILITIES, SELECTION_PROCEDURE_ROUNDS, SELECTION_PROCEDURE_DETAILS, IS_SELECTION_PROCEDURE_DETAILS_PDF,
|
FACILITIES, OTHER_FACILITIES, SELECTION_PROCEDURE_ROUNDS, SELECTION_PROCEDURE_DETAILS, IS_SELECTION_PROCEDURE_DETAILS_PDF,
|
||||||
SELECTION_PROCEDURE_DETAILS, OTHER_REQUIREMENTS,
|
SELECTION_PROCEDURE_DETAILS, OTHER_REQUIREMENTS,
|
||||||
CONTACT_PERSON_NAME, PHONE_NUMBER, EMAIL, RECAPTCHA_VALUE])
|
CONTACT_PERSON_NAME, PHONE_NUMBER, EMAIL])
|
||||||
def addInternship(request):
|
def addInternship(request):
|
||||||
logger.info("INF filled by " + str(request.data['email']))
|
logger.info("INF filled by " + str(request.data['email']))
|
||||||
logger.info(request.data)
|
logger.info(request.data)
|
||||||
|
@ -360,9 +361,6 @@ def addInternship(request):
|
||||||
data = request.data
|
data = request.data
|
||||||
files = request.FILES
|
files = request.FILES
|
||||||
internship = Internship()
|
internship = Internship()
|
||||||
if not verify_recaptcha(data[RECAPTCHA_VALUE]):
|
|
||||||
raise Exception("Recaptcha Failed")
|
|
||||||
|
|
||||||
internship.id = generateRandomString()
|
internship.id = generateRandomString()
|
||||||
# Add a company details in the internship
|
# Add a company details in the internship
|
||||||
internship.company_name = data[COMPANY_NAME]
|
internship.company_name = data[COMPANY_NAME]
|
||||||
|
|
|
@ -163,7 +163,15 @@ COMPENSATION_DETAILS_PDF = 'compensation_details_pdf'
|
||||||
COMPENSATION_DETAILS_PDF_NAMES = 'compensation_details_pdf_names'
|
COMPENSATION_DETAILS_PDF_NAMES = 'compensation_details_pdf_names'
|
||||||
IS_COMPENSATION_DETAILS_PDF = 'is_compensation_details_pdf'
|
IS_COMPENSATION_DETAILS_PDF = 'is_compensation_details_pdf'
|
||||||
ALLOWED_BATCH = 'allowed_batch'
|
ALLOWED_BATCH = 'allowed_batch'
|
||||||
ALLOWED_BRANCH = 'allowed_branch'
|
BTECH_ALLOWED = 'btech_allowed'
|
||||||
|
MTECH_ALLOWED = 'mtech_allowed'
|
||||||
|
MS_ALLOWED = 'ms_allowed'
|
||||||
|
PHD_ALLOWED = 'phd_allowed'
|
||||||
|
BTECH_BRANCH = 'btech_branches'
|
||||||
|
MTECH_BRANCH = 'mtech_branches'
|
||||||
|
MS_BRANCH = 'ms_branches'
|
||||||
|
PHD_BRANCH = 'phd_branches'
|
||||||
|
ALLOWED_BRANCH = 'allowed_batch'
|
||||||
RS_ELIGIBLE = 'rs_eligible'
|
RS_ELIGIBLE = 'rs_eligible'
|
||||||
BOND_DETAILS = 'bond_details'
|
BOND_DETAILS = 'bond_details'
|
||||||
SELECTION_PROCEDURE_ROUNDS = 'selection_procedure_rounds'
|
SELECTION_PROCEDURE_ROUNDS = 'selection_procedure_rounds'
|
||||||
|
|
|
@ -0,0 +1,147 @@
|
||||||
|
# Generated by Django 3.2.13 on 2023-11-30 19:02
|
||||||
|
|
||||||
|
import django.contrib.postgres.fields
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
from django.db.migrations.operations import RunPython
|
||||||
|
|
||||||
|
def eligibility_conversion(apps, schema_editor):
|
||||||
|
Placement = apps.get_model('APIs', 'Placement')
|
||||||
|
HistoricalPlacement = apps.get_model('APIs', 'HistoricalPlacement')
|
||||||
|
for placement in Placement.objects.all():
|
||||||
|
placement.btech_allowed = True
|
||||||
|
placement.btech_allowed_branch = placement.allowed_branch
|
||||||
|
if placement.rs_eligible:
|
||||||
|
placement.mtech_allowed = True
|
||||||
|
placement.ms_allowed = True
|
||||||
|
placement.phd_allowed = True
|
||||||
|
placement.mtech_allowed_branch = placement.allowed_branch
|
||||||
|
placement.ms_allowed_branch = placement.allowed_branch
|
||||||
|
placement.phd_allowed_branch = placement.allowed_branch
|
||||||
|
placement.save()
|
||||||
|
|
||||||
|
for placement in HistoricalPlacement.objects.all():
|
||||||
|
placement.btech_allowed = True
|
||||||
|
placement.btech_allowed_branch = placement.allowed_branch
|
||||||
|
if placement.rs_eligible:
|
||||||
|
placement.mtech_allowed = True
|
||||||
|
placement.ms_allowed = True
|
||||||
|
placement.phd_allowed = True
|
||||||
|
placement.mtech_allowed_branch = placement.allowed_branch
|
||||||
|
placement.ms_allowed_branch = placement.allowed_branch
|
||||||
|
placement.phd_allowed_branch = placement.allowed_branch
|
||||||
|
placement.save()
|
||||||
|
|
||||||
|
def reverse_eligibility_conversion(apps, schema_editor):
|
||||||
|
Placement = apps.get_model('APIs', 'Placement')
|
||||||
|
HistoricalPlacement = apps.get_model('APIs', 'HistoricalPlacement')
|
||||||
|
for placement in Placement.objects.all():
|
||||||
|
placement.allowed_branch = placement.btech_allowed_branch
|
||||||
|
placement.rs_eligible = placement.mtech_allowed or placement.ms_allowed or placement.phd_allowed
|
||||||
|
placement.save()
|
||||||
|
|
||||||
|
for placement in HistoricalPlacement.objects.all():
|
||||||
|
placement.allowed_branch = placement.btech_allowed_branch
|
||||||
|
placement.rs_eligible = placement.mtech_allowed or placement.ms_allowed or placement.phd_allowed
|
||||||
|
placement.save()
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('APIs', '0012_auto_20231010_0046'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='historicalplacement',
|
||||||
|
name='btech_allowed',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='historicalplacement',
|
||||||
|
name='btech_allowed_branch',
|
||||||
|
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP'], ['CIVIL', 'CIVIL'], ['CHEMICAL', 'CHEMICAL'], ['BSMS', 'BSMS']], max_length=10), default=list, size=7),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='historicalplacement',
|
||||||
|
name='ms_allowed',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='historicalplacement',
|
||||||
|
name='ms_allowed_branch',
|
||||||
|
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP'], ['CIVIL', 'CIVIL'], ['CHEMICAL', 'CHEMICAL'], ['BSMS', 'BSMS']], max_length=10), default=list, size=7),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='historicalplacement',
|
||||||
|
name='mtech_allowed',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='historicalplacement',
|
||||||
|
name='mtech_allowed_branch',
|
||||||
|
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP'], ['CIVIL', 'CIVIL'], ['CHEMICAL', 'CHEMICAL'], ['BSMS', 'BSMS']], max_length=10), default=list, size=7),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='historicalplacement',
|
||||||
|
name='phd_allowed',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='historicalplacement',
|
||||||
|
name='phd_allowed_branch',
|
||||||
|
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP'], ['CIVIL', 'CIVIL'], ['CHEMICAL', 'CHEMICAL'], ['BSMS', 'BSMS']], max_length=10), default=list, size=7),
|
||||||
|
),
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name='historicalstudent',
|
||||||
|
old_name='can_apply',
|
||||||
|
new_name='can_apply_placements',
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='placement',
|
||||||
|
name='btech_allowed',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='placement',
|
||||||
|
name='btech_allowed_branch',
|
||||||
|
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP'], ['CIVIL', 'CIVIL'], ['CHEMICAL', 'CHEMICAL'], ['BSMS', 'BSMS']], max_length=10), default=list, size=7),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='placement',
|
||||||
|
name='ms_allowed',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='placement',
|
||||||
|
name='ms_allowed_branch',
|
||||||
|
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP'], ['CIVIL', 'CIVIL'], ['CHEMICAL', 'CHEMICAL'], ['BSMS', 'BSMS']], max_length=10), default=list, size=7),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='placement',
|
||||||
|
name='mtech_allowed',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='placement',
|
||||||
|
name='mtech_allowed_branch',
|
||||||
|
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP'], ['CIVIL', 'CIVIL'], ['CHEMICAL', 'CHEMICAL'], ['BSMS', 'BSMS']], max_length=10), default=list, size=7),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='placement',
|
||||||
|
name='phd_allowed',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='placement',
|
||||||
|
name='phd_allowed_branch',
|
||||||
|
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['CSE', 'CSE'], ['EE', 'EE'], ['ME', 'ME'], ['MMAE', 'MMAE'], ['EP', 'EP'], ['CIVIL', 'CIVIL'], ['CHEMICAL', 'CHEMICAL'], ['BSMS', 'BSMS']], max_length=10), default=list, size=7),
|
||||||
|
),
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name='student',
|
||||||
|
old_name='can_apply',
|
||||||
|
new_name='can_apply_placements',
|
||||||
|
),
|
||||||
|
migrations.RunPython(eligibility_conversion, reverse_eligibility_conversion),
|
||||||
|
]
|
|
@ -1,24 +0,0 @@
|
||||||
# Generated by Django 3.2.13 on 2023-10-26 05:20
|
|
||||||
|
|
||||||
import django.contrib.postgres.fields
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('APIs', '0013_auto_20231022_0236'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='historicalplacement',
|
|
||||||
name='allowed_degree',
|
|
||||||
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['bTech', 'B.Tech'], ['ms/phd', 'MS/ PhD'], ['mTech', 'M.Tech']], max_length=10), default=['bTech'], size=3),
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='placement',
|
|
||||||
name='allowed_degree',
|
|
||||||
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['bTech', 'B.Tech'], ['ms/phd', 'MS/ PhD'], ['mTech', 'M.Tech']], max_length=10), default=['bTech'], size=3),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 3.2.13 on 2023-10-21 21:06
|
# Generated by Django 3.2.13 on 2023-11-30 21:08
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
@ -6,24 +6,32 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('APIs', '0012_auto_20231010_0046'),
|
('APIs', '0013_auto_20231201_0032'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.RemoveField(
|
migrations.RemoveField(
|
||||||
model_name='historicalstudent',
|
model_name='historicalplacement',
|
||||||
name='can_apply',
|
name='allowed_branch',
|
||||||
),
|
),
|
||||||
migrations.RemoveField(
|
migrations.RemoveField(
|
||||||
model_name='student',
|
model_name='historicalplacement',
|
||||||
name='can_apply',
|
name='rs_eligible',
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.RemoveField(
|
||||||
|
model_name='placement',
|
||||||
|
name='allowed_branch',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='placement',
|
||||||
|
name='rs_eligible',
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
model_name='historicalstudent',
|
model_name='historicalstudent',
|
||||||
name='can_apply_placements',
|
name='can_apply_placements',
|
||||||
field=models.BooleanField(default=True, verbose_name='Placement_Registered'),
|
field=models.BooleanField(default=True, verbose_name='Placement_Registered'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AlterField(
|
||||||
model_name='student',
|
model_name='student',
|
||||||
name='can_apply_placements',
|
name='can_apply_placements',
|
||||||
field=models.BooleanField(default=True, verbose_name='Placement_Registered'),
|
field=models.BooleanField(default=True, verbose_name='Placement_Registered'),
|
|
@ -1,26 +0,0 @@
|
||||||
# Generated by Django 3.2.13 on 2023-10-26 05:21
|
|
||||||
|
|
||||||
import django.contrib.postgres.fields
|
|
||||||
from django.db import migrations, models
|
|
||||||
from django.db.migrations.operations.special import RunPython
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('APIs', '0014_auto_20231026_1050'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='historicalplacement',
|
|
||||||
name='allowed_degree',
|
|
||||||
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['bTech', 'B.Tech'], ['ms/phd', 'MS/ PhD'], ['mTech', 'M.Tech']], max_length=10), default=list, size=3),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='placement',
|
|
||||||
name='allowed_degree',
|
|
||||||
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[['bTech', 'B.Tech'], ['ms/phd', 'MS/ PhD'], ['mTech', 'M.Tech']], max_length=10), default=list, size=3),
|
|
||||||
),
|
|
||||||
|
|
||||||
]
|
|
|
@ -1,31 +0,0 @@
|
||||||
# Generated by Django 3.2.13 on 2023-10-26 05:35
|
|
||||||
|
|
||||||
from django.db import migrations
|
|
||||||
from django.db.migrations.operations.special import RunPython
|
|
||||||
|
|
||||||
|
|
||||||
def convert_boolean_to_array(apps, schema_editor):
|
|
||||||
Placement = apps.get_model('APIs', 'Placement')
|
|
||||||
HistorcalPlacement = apps.get_model('APIs','historicalplacement')
|
|
||||||
for obj in Placement.objects.all():
|
|
||||||
if obj.rs_eligible:
|
|
||||||
obj.allowed_degree = ["bTech","ms/phd","mTech"]
|
|
||||||
else:
|
|
||||||
obj.allowed_degree = ["bTech"]
|
|
||||||
obj.save()
|
|
||||||
for obj in HistorcalPlacement.objects.all():
|
|
||||||
if obj.rs_eligible:
|
|
||||||
obj.allowed_degree = ["bTech","ms/phd","mTech"]
|
|
||||||
else:
|
|
||||||
obj.allowed_degree = ["bTech"]
|
|
||||||
obj.save()
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('APIs', '0015_auto_20231026_1051'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
RunPython(convert_boolean_to_array)
|
|
||||||
]
|
|
|
@ -6,9 +6,6 @@ from simple_history.models import HistoricalRecords
|
||||||
from .constants import *
|
from .constants import *
|
||||||
|
|
||||||
|
|
||||||
# from .utils import *
|
|
||||||
|
|
||||||
|
|
||||||
class User(models.Model):
|
class User(models.Model):
|
||||||
email = models.EmailField(primary_key=True, blank=False, max_length=JNF_TEXT_MAX_CHARACTER_COUNT)
|
email = models.EmailField(primary_key=True, blank=False, max_length=JNF_TEXT_MAX_CHARACTER_COUNT)
|
||||||
id = models.CharField(blank=False, max_length=25, db_index=True)
|
id = models.CharField(blank=False, max_length=25, db_index=True)
|
||||||
|
@ -129,19 +126,31 @@ class Placement(models.Model):
|
||||||
size=TOTAL_BATCHES,
|
size=TOTAL_BATCHES,
|
||||||
default=list
|
default=list
|
||||||
)
|
)
|
||||||
allowed_degree = ArrayField(
|
btech_allowed = models.BooleanField(blank=False, default=False)
|
||||||
models.CharField(max_length=10,choices=DEGREE_CHOICES),
|
btech_allowed_branch = ArrayField(
|
||||||
size=len(DEGREE_CHOICES),
|
models.CharField(choices=BRANCH_CHOICES, blank=False, max_length=10),
|
||||||
|
size=TOTAL_BRANCHES,
|
||||||
default=list
|
default=list
|
||||||
)
|
)
|
||||||
|
mtech_allowed = models.BooleanField(blank=False, default=False)
|
||||||
allowed_branch = ArrayField(
|
mtech_allowed_branch = ArrayField(
|
||||||
|
models.CharField(choices=BRANCH_CHOICES, blank=False, max_length=10),
|
||||||
|
size=TOTAL_BRANCHES,
|
||||||
|
default=list
|
||||||
|
)
|
||||||
|
ms_allowed = models.BooleanField(blank=False, default=False)
|
||||||
|
ms_allowed_branch = ArrayField(
|
||||||
|
models.CharField(choices=BRANCH_CHOICES, blank=False, max_length=10),
|
||||||
|
size=TOTAL_BRANCHES,
|
||||||
|
default=list
|
||||||
|
)
|
||||||
|
phd_allowed = models.BooleanField(blank=False, default=False)
|
||||||
|
phd_allowed_branch = ArrayField(
|
||||||
models.CharField(choices=BRANCH_CHOICES, blank=False, max_length=10),
|
models.CharField(choices=BRANCH_CHOICES, blank=False, max_length=10),
|
||||||
size=TOTAL_BRANCHES,
|
size=TOTAL_BRANCHES,
|
||||||
default=list
|
default=list
|
||||||
)
|
)
|
||||||
tentative_no_of_offers = models.IntegerField(blank=False, default=None, null=True)
|
tentative_no_of_offers = models.IntegerField(blank=False, default=None, null=True)
|
||||||
rs_eligible = models.BooleanField(blank=False, default=False)
|
|
||||||
other_requirements = models.CharField(blank=True, max_length=JNF_TEXTAREA_MAX_CHARACTER_COUNT, default="")
|
other_requirements = models.CharField(blank=True, max_length=JNF_TEXTAREA_MAX_CHARACTER_COUNT, default="")
|
||||||
additional_info = ArrayField(models.CharField(blank=True, max_length=JNF_TEXTMEDIUM_MAX_CHARACTER_COUNT), size=15,
|
additional_info = ArrayField(models.CharField(blank=True, max_length=JNF_TEXTMEDIUM_MAX_CHARACTER_COUNT), size=15,
|
||||||
default=list, blank=True)
|
default=list, blank=True)
|
||||||
|
|
|
@ -101,10 +101,28 @@ def getDashboard(request, id, email, user_type):
|
||||||
try:
|
try:
|
||||||
studentDetails = get_object_or_404(Student, id=id)
|
studentDetails = get_object_or_404(Student, id=id)
|
||||||
|
|
||||||
placements = Placement.objects.filter(allowed_batch__contains=[studentDetails.batch],
|
placements = []
|
||||||
allowed_branch__contains=[studentDetails.branch],
|
if studentDetails.degree == 'bTech':
|
||||||
|
placements = Placement.objects.filter(btech_allowed = True,
|
||||||
|
btech_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')
|
||||||
|
elif studentDetails.degree == 'mTech':
|
||||||
|
placements = Placement.objects.filter(mtech_allowed = True,
|
||||||
|
mtech_allowed_branch__contains=[studentDetails.branch],
|
||||||
|
deadline_datetime__gte=datetime.datetime.now(),
|
||||||
|
offer_accepted=True, email_verified=True).order_by('deadline_datetime')
|
||||||
|
elif studentDetails.degree == 'ms':
|
||||||
|
placements = Placement.objects.filter(ms_allowed = True,
|
||||||
|
ms_allowed_branch__contains=[studentDetails.branch],
|
||||||
|
deadline_datetime__gte=datetime.datetime.now(),
|
||||||
|
offer_accepted=True, email_verified=True).order_by('deadline_datetime')
|
||||||
|
elif studentDetails.degree == 'phd':
|
||||||
|
placements = Placement.objects.filter(phd_allowed = True,
|
||||||
|
phd_allowed_branch__contains=[studentDetails.branch],
|
||||||
|
deadline_datetime__gte=datetime.datetime.now(),
|
||||||
|
offer_accepted=True, email_verified=True).order_by('deadline_datetime')
|
||||||
|
|
||||||
filtered_placements = placement_eligibility_filters(studentDetails, placements)
|
filtered_placements = placement_eligibility_filters(studentDetails, placements)
|
||||||
|
|
||||||
placementsdata = PlacementSerializerForStudent(filtered_placements, many=True).data
|
placementsdata = PlacementSerializerForStudent(filtered_placements, many=True).data
|
||||||
|
@ -187,7 +205,6 @@ def submitApplication(request, id, email, user_type):
|
||||||
application = PlacementApplication()
|
application = PlacementApplication()
|
||||||
opening = get_object_or_404(Placement, id=data[OPENING_ID],
|
opening = get_object_or_404(Placement, id=data[OPENING_ID],
|
||||||
allowed_batch__contains=[student.batch],
|
allowed_batch__contains=[student.batch],
|
||||||
allowed_branch__contains=[student.branch],
|
|
||||||
deadline_datetime__gte=timezone.now()
|
deadline_datetime__gte=timezone.now()
|
||||||
)
|
)
|
||||||
if not opening.offer_accepted or not opening.email_verified:
|
if not opening.offer_accepted or not opening.email_verified:
|
||||||
|
|
|
@ -261,7 +261,22 @@ def PlacementApplicationConditions(student, placement):
|
||||||
elif int(i.tier) == 1 and int(placement.tier) != 1:
|
elif int(i.tier) == 1 and int(placement.tier) != 1:
|
||||||
return False, "Can't apply for this tier"
|
return False, "Can't apply for this tier"
|
||||||
|
|
||||||
if student.degree != 'bTech' and not placement.rs_eligible:
|
if student.degree == 'bTech' and not placement.btech_allowed:
|
||||||
|
raise PermissionError("Can't apply for this placement")
|
||||||
|
if student.degree == 'mTech' and not placement.mtech_allowed:
|
||||||
|
raise PermissionError("Can't apply for this placement")
|
||||||
|
if student.degree == 'ms' and not placement.ms_allowed:
|
||||||
|
raise PermissionError("Can't apply for this placement")
|
||||||
|
if student.degree == 'phd' and not placement.phd_allowed:
|
||||||
|
raise PermissionError("Can't apply for this placement")
|
||||||
|
|
||||||
|
if student.degree == 'bTech' and student.branch not in placement.btech_allowed_branch:
|
||||||
|
raise PermissionError("Can't apply for this placement")
|
||||||
|
if student.degree == 'mTech' and student.branch not in placement.mtech_allowed_branch:
|
||||||
|
raise PermissionError("Can't apply for this placement")
|
||||||
|
if student.degree == 'ms' and student.branch not in placement.ms_allowed_branch:
|
||||||
|
raise PermissionError("Can't apply for this placement")
|
||||||
|
if student.degree == 'phd' and student.branch not in placement.phd_allowed_branch:
|
||||||
raise PermissionError("Can't apply for this placement")
|
raise PermissionError("Can't apply for this placement")
|
||||||
|
|
||||||
return True, "Conditions Satisfied"
|
return True, "Conditions Satisfied"
|
||||||
|
|
Loading…
Reference in New Issue