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,
|
||||
DESCRIPTION,
|
||||
IS_DESCRIPTION_PDF, COMPENSATION_CTC, COMPENSATION_GROSS, COMPENSATION_TAKE_HOME, COMPENSATION_BONUS,
|
||||
IS_COMPENSATION_DETAILS_PDF, ALLOWED_BRANCH, RS_ELIGIBLE, SELECTION_PROCEDURE_ROUNDS,
|
||||
SELECTION_PROCEDURE_DETAILS,
|
||||
IS_COMPENSATION_DETAILS_PDF, BTECH_ALLOWED, MTECH_ALLOWED, MS_ALLOWED, PHD_ALLOWED,
|
||||
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,
|
||||
RECAPTCHA_VALUE, JOB_LOCATION
|
||||
JOB_LOCATION
|
||||
])
|
||||
def addPlacement(request):
|
||||
logger.info("JNF filled by " + str(request.data['email']))
|
||||
|
@ -23,8 +24,6 @@ def addPlacement(request):
|
|||
data = request.data
|
||||
files = request.FILES
|
||||
opening = Placement()
|
||||
if not verify_recaptcha(data[RECAPTCHA_VALUE]):
|
||||
raise Exception("Recaptcha Failed")
|
||||
|
||||
opening.id = generateRandomString()
|
||||
# Add a company details in the opening
|
||||
|
@ -36,10 +35,6 @@ def addPlacement(request):
|
|||
opening.website = data[WEBSITE]
|
||||
opening.company_details = data[COMPANY_DETAILS]
|
||||
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:
|
||||
company_details_pdf = []
|
||||
|
@ -198,13 +193,19 @@ def addPlacement(request):
|
|||
|
||||
# Only Allowing Fourth Year for Placement
|
||||
opening.allowed_batch = [FOURTH_YEAR,]
|
||||
# Check if allowed_branch are valid
|
||||
if data[ALLOWED_BRANCH] is None:
|
||||
raise ValueError('Allowed Branch cannot be empty')
|
||||
elif set(json.loads(data[ALLOWED_BRANCH])).issubset(BRANCHES):
|
||||
opening.allowed_branch = json.loads(data[ALLOWED_BRANCH])
|
||||
else:
|
||||
raise ValueError('Allowed Branch must be a subset of ' + str(BRANCHES))
|
||||
opening.btech_allowed = data[BTECH_ALLOWED] == "true"
|
||||
opening.mtech_allowed = data[MTECH_ALLOWED] == "true"
|
||||
opening.ms_allowed = data[MS_ALLOWED] == "true"
|
||||
opening.phd_allowed = data[PHD_ALLOWED] == "true"
|
||||
|
||||
if opening.btech_allowed:
|
||||
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
|
||||
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,
|
||||
FACILITIES, OTHER_FACILITIES, SELECTION_PROCEDURE_ROUNDS, SELECTION_PROCEDURE_DETAILS, IS_SELECTION_PROCEDURE_DETAILS_PDF,
|
||||
SELECTION_PROCEDURE_DETAILS, OTHER_REQUIREMENTS,
|
||||
CONTACT_PERSON_NAME, PHONE_NUMBER, EMAIL, RECAPTCHA_VALUE])
|
||||
CONTACT_PERSON_NAME, PHONE_NUMBER, EMAIL])
|
||||
def addInternship(request):
|
||||
logger.info("INF filled by " + str(request.data['email']))
|
||||
logger.info(request.data)
|
||||
|
@ -360,9 +361,6 @@ def addInternship(request):
|
|||
data = request.data
|
||||
files = request.FILES
|
||||
internship = Internship()
|
||||
if not verify_recaptcha(data[RECAPTCHA_VALUE]):
|
||||
raise Exception("Recaptcha Failed")
|
||||
|
||||
internship.id = generateRandomString()
|
||||
# Add a company details in the internship
|
||||
internship.company_name = data[COMPANY_NAME]
|
||||
|
|
|
@ -163,7 +163,15 @@ COMPENSATION_DETAILS_PDF = 'compensation_details_pdf'
|
|||
COMPENSATION_DETAILS_PDF_NAMES = 'compensation_details_pdf_names'
|
||||
IS_COMPENSATION_DETAILS_PDF = 'is_compensation_details_pdf'
|
||||
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'
|
||||
BOND_DETAILS = 'bond_details'
|
||||
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
|
||||
|
||||
|
@ -6,24 +6,32 @@ from django.db import migrations, models
|
|||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('APIs', '0012_auto_20231010_0046'),
|
||||
('APIs', '0013_auto_20231201_0032'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='historicalstudent',
|
||||
name='can_apply',
|
||||
model_name='historicalplacement',
|
||||
name='allowed_branch',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='student',
|
||||
name='can_apply',
|
||||
model_name='historicalplacement',
|
||||
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',
|
||||
name='can_apply_placements',
|
||||
field=models.BooleanField(default=True, verbose_name='Placement_Registered'),
|
||||
),
|
||||
migrations.AddField(
|
||||
migrations.AlterField(
|
||||
model_name='student',
|
||||
name='can_apply_placements',
|
||||
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 .utils import *
|
||||
|
||||
|
||||
class User(models.Model):
|
||||
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)
|
||||
|
@ -129,19 +126,31 @@ class Placement(models.Model):
|
|||
size=TOTAL_BATCHES,
|
||||
default=list
|
||||
)
|
||||
allowed_degree = ArrayField(
|
||||
models.CharField(max_length=10,choices=DEGREE_CHOICES),
|
||||
size=len(DEGREE_CHOICES),
|
||||
btech_allowed = models.BooleanField(blank=False, default=False)
|
||||
btech_allowed_branch = ArrayField(
|
||||
models.CharField(choices=BRANCH_CHOICES, blank=False, max_length=10),
|
||||
size=TOTAL_BRANCHES,
|
||||
default=list
|
||||
)
|
||||
|
||||
allowed_branch = ArrayField(
|
||||
mtech_allowed = models.BooleanField(blank=False, default=False)
|
||||
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),
|
||||
size=TOTAL_BRANCHES,
|
||||
default=list
|
||||
)
|
||||
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="")
|
||||
additional_info = ArrayField(models.CharField(blank=True, max_length=JNF_TEXTMEDIUM_MAX_CHARACTER_COUNT), size=15,
|
||||
default=list, blank=True)
|
||||
|
|
|
@ -101,10 +101,28 @@ def getDashboard(request, id, email, user_type):
|
|||
try:
|
||||
studentDetails = get_object_or_404(Student, id=id)
|
||||
|
||||
placements = Placement.objects.filter(allowed_batch__contains=[studentDetails.batch],
|
||||
allowed_branch__contains=[studentDetails.branch],
|
||||
placements = []
|
||||
if studentDetails.degree == 'bTech':
|
||||
placements = Placement.objects.filter(btech_allowed = True,
|
||||
btech_allowed_branch__contains=[studentDetails.branch],
|
||||
deadline_datetime__gte=datetime.datetime.now(),
|
||||
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)
|
||||
|
||||
placementsdata = PlacementSerializerForStudent(filtered_placements, many=True).data
|
||||
|
@ -187,7 +205,6 @@ def submitApplication(request, id, email, user_type):
|
|||
application = PlacementApplication()
|
||||
opening = get_object_or_404(Placement, id=data[OPENING_ID],
|
||||
allowed_batch__contains=[student.batch],
|
||||
allowed_branch__contains=[student.branch],
|
||||
deadline_datetime__gte=timezone.now()
|
||||
)
|
||||
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:
|
||||
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")
|
||||
|
||||
return True, "Conditions Satisfied"
|
||||
|
|
Loading…
Reference in New Issue