2021-10-15 20:47:23 +05:30
|
|
|
from django.contrib.postgres.fields import ArrayField
|
|
|
|
from django.db import models
|
|
|
|
from django.utils import timezone
|
2022-07-21 16:41:31 +05:30
|
|
|
from simple_history.models import HistoricalRecords
|
2022-05-02 17:16:56 +05:30
|
|
|
|
2021-10-15 20:47:23 +05:30
|
|
|
from .constants import *
|
2021-12-03 01:04:49 +05:30
|
|
|
|
2021-10-15 20:47:23 +05:30
|
|
|
|
2022-05-02 17:16:56 +05:30
|
|
|
# from .utils import *
|
|
|
|
|
2021-10-15 20:47:23 +05:30
|
|
|
|
|
|
|
class User(models.Model):
|
2022-05-24 15:07:32 +05:30
|
|
|
email = models.EmailField(primary_key=True, blank=False, max_length=JNF_TEXT_MAX_CHARACTER_COUNT)
|
2022-07-28 14:37:41 +05:30
|
|
|
id = models.CharField(blank=False, max_length=25, db_index=True)
|
2021-10-15 20:47:23 +05:30
|
|
|
user_type = ArrayField(models.CharField(blank=False, max_length=10), size=4, default=list, blank=False)
|
2022-05-02 17:16:56 +05:30
|
|
|
last_login_time = models.DateTimeField(default=timezone.now)
|
2022-07-21 16:41:31 +05:30
|
|
|
history = HistoricalRecords()
|
2021-10-15 20:47:23 +05:30
|
|
|
|
2022-05-24 15:07:32 +05:30
|
|
|
class Meta:
|
|
|
|
verbose_name_plural = "User"
|
|
|
|
unique_together = ('email', 'id')
|
|
|
|
|
2021-10-15 20:47:23 +05:30
|
|
|
|
|
|
|
class Student(models.Model):
|
|
|
|
id = models.CharField(blank=False, max_length=15, primary_key=True)
|
2023-09-10 13:46:13 +05:30
|
|
|
roll_no = models.CharField(blank=False, max_length=15, unique=True)
|
2022-05-24 15:07:32 +05:30
|
|
|
name = models.CharField(blank=False, max_length=JNF_TEXT_MAX_CHARACTER_COUNT)
|
2021-10-15 20:47:23 +05:30
|
|
|
batch = models.CharField(max_length=10, choices=BATCH_CHOICES, blank=False)
|
2024-08-14 22:42:40 +05:30
|
|
|
branch = models.CharField(choices=BRANCH_CHOICES, blank=True,default=None, null=True, max_length=10)
|
2021-10-15 20:47:23 +05:30
|
|
|
phone_number = models.PositiveBigIntegerField(blank=True, default=None, null=True)
|
2022-05-24 15:07:32 +05:30
|
|
|
resumes = ArrayField(models.CharField(null=True, default=None, max_length=JNF_TEXT_MAX_CHARACTER_COUNT), size=10,
|
|
|
|
default=list, blank=True)
|
2021-10-15 20:47:23 +05:30
|
|
|
cpi = models.DecimalField(decimal_places=2, max_digits=4)
|
2022-05-02 17:16:56 +05:30
|
|
|
can_apply = models.BooleanField(default=True, verbose_name='Registered')
|
2024-07-25 19:58:26 +05:30
|
|
|
can_apply_internship = models.BooleanField(default=True, verbose_name='Internship Registered')
|
2022-07-21 16:41:31 +05:30
|
|
|
changed_by = models.ForeignKey(User, blank=True, on_delete=models.RESTRICT, default=None, null=True)
|
2024-07-25 19:58:26 +05:30
|
|
|
degree = models.CharField(choices=ELIGIBLE_CHOICES, blank=False, max_length=10, default=ELIGIBLE_CHOICES[0][0]) # should be ELIGIBLE_CHOICES
|
2024-07-21 21:53:34 +05:30
|
|
|
isPwd = models.BooleanField(default=False, verbose_name='Person with Disability')
|
|
|
|
isBacklog = models.BooleanField(default=False, verbose_name='Has Backlog')
|
2022-07-21 16:41:31 +05:30
|
|
|
history = HistoricalRecords(user_model=User)
|
2021-10-15 20:47:23 +05:30
|
|
|
|
2021-12-16 23:05:04 +05:30
|
|
|
def __str__(self):
|
|
|
|
return str(self.roll_no)
|
|
|
|
|
2022-07-21 16:41:31 +05:30
|
|
|
@property
|
|
|
|
def _history_user(self):
|
|
|
|
return self.changed_by
|
2022-09-13 01:03:22 +05:30
|
|
|
|
2022-07-21 16:41:31 +05:30
|
|
|
@_history_user.setter
|
|
|
|
def _history_user(self, value):
|
|
|
|
if isinstance(value, User):
|
|
|
|
self.changed_by = value
|
|
|
|
else:
|
|
|
|
self.changed_by = None
|
|
|
|
|
|
|
|
|
2021-10-15 20:47:23 +05:30
|
|
|
class Admin(models.Model):
|
|
|
|
id = models.CharField(blank=False, max_length=15, primary_key=True)
|
2022-05-24 15:07:32 +05:30
|
|
|
name = models.CharField(blank=False, max_length=JNF_TEXT_MAX_CHARACTER_COUNT)
|
2022-07-21 16:41:31 +05:30
|
|
|
changed_by = models.ForeignKey(User, blank=True, on_delete=models.RESTRICT, default=None, null=True)
|
|
|
|
history = HistoricalRecords(user_model=User)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def _history_user(self):
|
|
|
|
return self.changed_by
|
2022-09-13 01:03:22 +05:30
|
|
|
|
2022-07-21 16:41:31 +05:30
|
|
|
@_history_user.setter
|
|
|
|
def _history_user(self, value):
|
|
|
|
if isinstance(value, User):
|
|
|
|
self.changed_by = value
|
|
|
|
else:
|
|
|
|
self.changed_by = None
|
2021-10-15 20:47:23 +05:30
|
|
|
|
|
|
|
|
2021-12-03 01:04:49 +05:30
|
|
|
def two_day_after_today():
|
2022-09-13 01:03:22 +05:30
|
|
|
# round off to nearest day
|
|
|
|
return timezone.now().replace(hour=0, minute=0, second=0, microsecond=0) + timezone.timedelta(days=2)
|
2021-12-03 01:04:49 +05:30
|
|
|
|
|
|
|
|
2021-10-15 20:47:23 +05:30
|
|
|
class Placement(models.Model):
|
|
|
|
id = models.CharField(blank=False, primary_key=True, max_length=15)
|
2021-12-03 01:04:49 +05:30
|
|
|
# Company Details
|
2022-05-24 15:07:32 +05:30
|
|
|
company_name = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT)
|
|
|
|
address = models.CharField(blank=False, max_length=JNF_TEXTAREA_MAX_CHARACTER_COUNT)
|
|
|
|
company_type = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT)
|
|
|
|
nature_of_business = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="")
|
|
|
|
type_of_organisation = models.CharField(max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="", blank=False)
|
|
|
|
website = models.CharField(blank=True, max_length=JNF_TEXT_MAX_CHARACTER_COUNT)
|
2022-09-12 11:24:50 +05:30
|
|
|
company_details = models.CharField(max_length=JNF_TEXTAREA_MAX_CHARACTER_COUNT, default=None, null=True, blank=True)
|
2022-05-24 15:07:32 +05:30
|
|
|
company_details_pdf_names = ArrayField(
|
|
|
|
models.CharField(null=True, default=None, max_length=JNF_TEXT_MAX_CHARACTER_COUNT), size=5,
|
|
|
|
default=list, blank=True)
|
2021-12-03 01:04:49 +05:30
|
|
|
is_company_details_pdf = models.BooleanField(blank=False, default=False)
|
2022-05-24 15:07:32 +05:30
|
|
|
contact_person_name = models.CharField(blank=False, max_length=JNF_TEXT_MAX_CHARACTER_COUNT)
|
2024-08-04 17:25:53 +05:30
|
|
|
phone_number = models.CharField(max_length=15, blank=False)
|
2022-05-24 15:07:32 +05:30
|
|
|
email = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="")
|
|
|
|
city = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="")
|
|
|
|
state = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="")
|
|
|
|
country = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="")
|
2022-05-02 17:16:56 +05:30
|
|
|
pin_code = models.IntegerField(blank=False, default=None, null=True)
|
2021-10-15 20:47:23 +05:30
|
|
|
city_type = models.CharField(blank=False, max_length=15, choices=OFFER_CITY_TYPE)
|
2024-06-21 00:15:00 +05:30
|
|
|
cpi_eligible = models.DecimalField(decimal_places=2, default=0.00, max_digits=4) #newly added field
|
2021-12-03 01:04:49 +05:30
|
|
|
# Job Details
|
2022-05-24 15:07:32 +05:30
|
|
|
designation = models.CharField(blank=False, max_length=JNF_TEXT_MAX_CHARACTER_COUNT, default=None, null=True)
|
|
|
|
description = models.CharField(blank=False, max_length=JNF_TEXTAREA_MAX_CHARACTER_COUNT, default=None, null=True)
|
|
|
|
job_location = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="")
|
|
|
|
description_pdf_names = ArrayField(
|
|
|
|
models.CharField(null=True, default=None, max_length=JNF_TEXT_MAX_CHARACTER_COUNT), size=5, default=list,
|
|
|
|
blank=True)
|
2021-12-03 01:04:49 +05:30
|
|
|
is_description_pdf = models.BooleanField(blank=False, default=False)
|
2022-05-02 17:16:56 +05:30
|
|
|
compensation_CTC = models.IntegerField(blank=False, default=None, null=True) # Job - Per Year
|
2024-07-24 23:27:27 +05:30
|
|
|
company_turnover = models.IntegerField(blank=True, default=None, null=True) # newly added field
|
2021-12-03 01:04:49 +05:30
|
|
|
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)
|
2022-05-24 15:07:32 +05:30
|
|
|
compensation_details_pdf_names = ArrayField(
|
|
|
|
models.CharField(null=True, default=None, max_length=JNF_TEXT_MAX_CHARACTER_COUNT), size=5,
|
|
|
|
default=list, blank=True)
|
2021-12-03 01:04:49 +05:30
|
|
|
is_compensation_details_pdf = models.BooleanField(blank=False, default=False)
|
2022-05-24 15:07:32 +05:30
|
|
|
bond_details = models.CharField(blank=True, max_length=JNF_TEXTAREA_MAX_CHARACTER_COUNT)
|
|
|
|
selection_procedure_rounds = ArrayField(
|
|
|
|
models.CharField(null=True, default=None, max_length=JNF_TEXT_MAX_CHARACTER_COUNT), size=10,
|
|
|
|
default=list, blank=True)
|
|
|
|
selection_procedure_details = models.CharField(blank=True, max_length=JNF_TEXTAREA_MAX_CHARACTER_COUNT)
|
|
|
|
selection_procedure_details_pdf_names = ArrayField(
|
|
|
|
models.CharField(null=True, default=None, max_length=JNF_TEXT_MAX_CHARACTER_COUNT),
|
|
|
|
size=5, default=list, blank=True)
|
2021-12-03 01:04:49 +05:30
|
|
|
is_selection_procedure_details_pdf = models.BooleanField(blank=False, default=False)
|
2021-10-15 20:47:23 +05:30
|
|
|
tier = models.CharField(blank=False, choices=TIERS, max_length=10, default=None, null=True)
|
2021-12-03 01:04:49 +05:30
|
|
|
tentative_date_of_joining = models.DateField(blank=False, verbose_name="Tentative Date", default=timezone.now)
|
2024-06-21 00:15:00 +05:30
|
|
|
establishment_date = models.DateField(blank=True, default=None, null=True) # newly added field
|
2021-10-15 20:47:23 +05:30
|
|
|
allowed_batch = ArrayField(
|
|
|
|
models.CharField(max_length=10, choices=BATCH_CHOICES),
|
|
|
|
size=TOTAL_BATCHES,
|
|
|
|
default=list
|
|
|
|
)
|
2021-12-03 01:04:49 +05:30
|
|
|
|
2021-10-15 20:47:23 +05:30
|
|
|
allowed_branch = ArrayField(
|
|
|
|
models.CharField(choices=BRANCH_CHOICES, blank=False, max_length=10),
|
|
|
|
size=TOTAL_BRANCHES,
|
|
|
|
default=list
|
|
|
|
)
|
2021-12-16 23:05:04 +05:30
|
|
|
tentative_no_of_offers = models.IntegerField(blank=False, default=None, null=True)
|
2024-06-21 00:15:00 +05:30
|
|
|
expected_no_of_offers = models.IntegerField(blank=False , default=None , null=True) # newly added
|
2024-07-24 23:27:27 +05:30
|
|
|
number_of_employees = models.IntegerField(blank=True, default=None, null=True) # newly added field
|
2024-07-19 11:56:33 +05:30
|
|
|
eligiblestudents = ArrayField(
|
|
|
|
models.CharField(choices=ELIGIBLE_CHOICES, blank=False, max_length=10),
|
|
|
|
size=10,
|
|
|
|
default=list
|
2024-07-21 21:53:34 +05:30
|
|
|
) #newly added field
|
2024-06-21 00:15:00 +05:30
|
|
|
pwd_eligible = models.BooleanField(blank=True, default=False) #newly added field
|
|
|
|
backlog_eligible = models.BooleanField(blank=True, default=False) #newly added field
|
|
|
|
psychometric_test = models.BooleanField(blank=True, default=False) #newly added field
|
|
|
|
medical_test = models.BooleanField(blank=True, default=False) #newly added field
|
2022-05-24 15:07:32 +05:30
|
|
|
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)
|
2021-12-03 01:04:49 +05:30
|
|
|
email_verified = models.BooleanField(blank=False, default=False)
|
|
|
|
offer_accepted = models.BooleanField(blank=False, default=None, null=True)
|
|
|
|
deadline_datetime = models.DateTimeField(blank=False, verbose_name="Deadline Date", default=two_day_after_today)
|
2021-10-15 20:47:23 +05:30
|
|
|
created_at = models.DateTimeField(blank=False, default=None, null=True)
|
2022-05-24 15:07:32 +05:30
|
|
|
updated_at = models.DateTimeField(blank=False, default=None, null=True)
|
2023-07-24 19:00:52 +05:30
|
|
|
changed_by = models.ForeignKey(User, on_delete=models.RESTRICT, blank=True, null=True)
|
2022-09-13 01:03:22 +05:30
|
|
|
history = HistoricalRecords(user_model=User)
|
|
|
|
|
2022-05-24 15:07:32 +05:30
|
|
|
def format(self):
|
|
|
|
if self.company_name is not None:
|
|
|
|
self.company_name = self.company_name.strip()[:JNF_SMALLTEXT_MAX_CHARACTER_COUNT]
|
|
|
|
if self.company_type is not None:
|
|
|
|
self.company_type = self.company_type.strip()[:JNF_SMALLTEXT_MAX_CHARACTER_COUNT]
|
|
|
|
if self.company_details is not None:
|
|
|
|
self.company_details = self.company_details.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
|
|
|
if self.address is not None:
|
|
|
|
self.address = self.address.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
|
|
|
if self.nature_of_business is not None:
|
|
|
|
self.nature_of_business = self.nature_of_business.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
|
|
|
if self.type_of_organisation is not None:
|
|
|
|
self.type_of_organisation = self.type_of_organisation.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
|
|
|
if self.website is not None:
|
|
|
|
self.website = self.website.strip()[:JNF_TEXT_MAX_CHARACTER_COUNT]
|
|
|
|
if self.contact_person_name is not None:
|
|
|
|
self.contact_person_name = self.contact_person_name.strip()[:JNF_TEXT_MAX_CHARACTER_COUNT]
|
|
|
|
if self.email is not None:
|
|
|
|
self.email = self.email.strip()[:JNF_SMALLTEXT_MAX_CHARACTER_COUNT]
|
|
|
|
if self.city is not None:
|
|
|
|
self.city = self.city.strip()[:JNF_SMALLTEXT_MAX_CHARACTER_COUNT]
|
|
|
|
if self.state is not None:
|
|
|
|
self.state = self.state.strip()[:JNF_SMALLTEXT_MAX_CHARACTER_COUNT]
|
|
|
|
if self.country is not None:
|
|
|
|
self.country = self.country.strip()[:JNF_SMALLTEXT_MAX_CHARACTER_COUNT]
|
|
|
|
if self.city_type is not None:
|
|
|
|
self.city_type = self.city_type.strip()[:JNF_SMALLTEXT_MAX_CHARACTER_COUNT]
|
|
|
|
if self.designation is not None:
|
|
|
|
self.designation = self.designation.strip()[:JNF_TEXT_MAX_CHARACTER_COUNT]
|
|
|
|
if self.description is not None:
|
|
|
|
self.description = self.description.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
|
|
|
if self.job_location is not None:
|
|
|
|
self.job_location = self.job_location.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
|
|
|
if self.selection_procedure_details is not None:
|
|
|
|
self.selection_procedure_details = self.selection_procedure_details.strip()[
|
|
|
|
:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
|
|
|
if self.bond_details is not None:
|
|
|
|
self.bond_details = self.bond_details.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
|
|
|
if self.other_requirements is not None:
|
|
|
|
self.other_requirements = self.other_requirements.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
|
|
|
if self.additional_info is not None:
|
2022-09-13 01:03:22 +05:30
|
|
|
self.additional_info = [info.strip()[:JNF_TEXTMEDIUM_MAX_CHARACTER_COUNT] for info in
|
|
|
|
list(self.additional_info)]
|
2021-10-15 20:47:23 +05:30
|
|
|
|
2022-07-21 16:41:31 +05:30
|
|
|
@property
|
|
|
|
def _history_user(self):
|
|
|
|
return self.changed_by
|
2022-09-13 01:03:22 +05:30
|
|
|
|
2022-07-21 16:41:31 +05:30
|
|
|
@_history_user.setter
|
|
|
|
def _history_user(self, value):
|
|
|
|
if isinstance(value, User):
|
|
|
|
self.changed_by = value
|
|
|
|
else:
|
|
|
|
self.changed_by = None
|
|
|
|
|
2021-12-03 01:04:49 +05:30
|
|
|
def save(self, *args, **kwargs):
|
|
|
|
''' On save, add timestamps '''
|
|
|
|
if not self.created_at:
|
|
|
|
self.created_at = timezone.now()
|
2022-05-24 15:07:32 +05:30
|
|
|
self.format()
|
|
|
|
self.updated_at = timezone.now()
|
2021-12-03 01:04:49 +05:30
|
|
|
return super(Placement, self).save(*args, **kwargs)
|
2021-10-15 20:47:23 +05:30
|
|
|
|
2021-12-16 23:05:04 +05:30
|
|
|
def __str__(self):
|
2023-08-05 02:10:41 +05:30
|
|
|
return self.company_name + " - " + self.designation
|
2021-12-16 23:05:04 +05:30
|
|
|
|
2022-05-02 17:16:56 +05:30
|
|
|
|
2021-10-15 20:47:23 +05:30
|
|
|
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)
|
|
|
|
student = models.ForeignKey(Student, blank=False, on_delete=models.CASCADE)
|
2022-05-24 15:07:32 +05:30
|
|
|
resume = models.CharField(max_length=JNF_TEXT_MAX_CHARACTER_COUNT, blank=False, null=True, default=None)
|
2021-12-03 01:04:49 +05:30
|
|
|
additional_info = models.JSONField(blank=True, null=True, default=None)
|
2021-10-15 20:47:23 +05:30
|
|
|
selected = models.BooleanField(null=True, default=None, blank=True)
|
2023-06-11 00:06:36 +05:30
|
|
|
offer_accepted = models.BooleanField(null=True, default=None, blank=True) # True if offer accepted, False if rejected, None if not yet decided
|
2021-10-15 20:47:23 +05:30
|
|
|
applied_at = models.DateTimeField(blank=False, default=None, null=True)
|
2022-05-23 23:18:09 +05:30
|
|
|
updated_at = models.DateTimeField(blank=False, default=None, null=True)
|
2022-07-21 16:41:31 +05:30
|
|
|
changed_by = models.ForeignKey(User, blank=False, on_delete=models.RESTRICT, default=None, null=True)
|
|
|
|
history = HistoricalRecords(user_model=User)
|
2021-10-15 20:47:23 +05:30
|
|
|
|
|
|
|
def save(self, *args, **kwargs):
|
|
|
|
''' On save, add timestamps '''
|
|
|
|
if not self.applied_at:
|
|
|
|
self.applied_at = timezone.now()
|
2022-05-23 23:18:09 +05:30
|
|
|
self.updated_at = timezone.now()
|
2021-10-15 20:47:23 +05:30
|
|
|
|
|
|
|
return super(PlacementApplication, self).save(*args, **kwargs)
|
|
|
|
|
2022-07-21 16:41:31 +05:30
|
|
|
@property
|
|
|
|
def _history_user(self):
|
|
|
|
return self.changed_by
|
2022-09-13 01:03:22 +05:30
|
|
|
|
2022-07-21 16:41:31 +05:30
|
|
|
@_history_user.setter
|
|
|
|
def _history_user(self, value):
|
|
|
|
if isinstance(value, User):
|
|
|
|
self.changed_by = value
|
|
|
|
else:
|
|
|
|
self.changed_by = None
|
2022-09-13 01:03:22 +05:30
|
|
|
|
2021-10-15 20:47:23 +05:30
|
|
|
class Meta:
|
|
|
|
verbose_name_plural = "Placement Applications"
|
2021-10-22 20:37:15 +05:30
|
|
|
unique_together = ('placement_id', 'student_id')
|
2021-10-15 20:47:23 +05:30
|
|
|
|
2021-12-16 23:05:04 +05:30
|
|
|
def __str__(self):
|
|
|
|
return self.placement.company_name + " - " + self.student.name
|
|
|
|
|
2021-10-15 20:47:23 +05:30
|
|
|
|
|
|
|
class PrePlacementOffer(models.Model):
|
|
|
|
id = models.AutoField(primary_key=True)
|
|
|
|
student = models.ForeignKey(Student, on_delete=models.CASCADE, blank=False)
|
2022-05-24 15:07:32 +05:30
|
|
|
company = models.CharField(max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, blank=False, default="",
|
|
|
|
verbose_name="Company Name")
|
2021-10-15 20:47:23 +05:30
|
|
|
compensation = models.IntegerField(blank=False) # Job - Per Year
|
|
|
|
compensation_details = models.CharField(blank=True, max_length=200)
|
|
|
|
tier = models.CharField(blank=False, choices=TIERS, max_length=10)
|
2022-09-20 00:48:49 +05:30
|
|
|
designation = models.CharField(blank=False, max_length=100, default=None, null=True)
|
2021-10-15 20:47:23 +05:30
|
|
|
accepted = models.BooleanField(default=None, null=True)
|
2022-07-21 16:41:31 +05:30
|
|
|
changed_by = models.ForeignKey(User, blank=False, on_delete=models.RESTRICT, default=None, null=True)
|
|
|
|
history = HistoricalRecords(user_model=User)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def _history_user(self):
|
|
|
|
return self.changed_by
|
2022-09-13 01:03:22 +05:30
|
|
|
|
2022-07-21 16:41:31 +05:30
|
|
|
@_history_user.setter
|
|
|
|
def _history_user(self, value):
|
|
|
|
if isinstance(value, User):
|
|
|
|
self.changed_by = value
|
|
|
|
else:
|
|
|
|
self.changed_by = None
|
2022-11-03 16:46:56 +05:30
|
|
|
|
2023-07-24 19:00:52 +05:30
|
|
|
class Internship(models.Model):
|
|
|
|
id = models.CharField(blank=False, primary_key=True, max_length=15) #unique id for each internship
|
|
|
|
# Company Details
|
|
|
|
company_name = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT)
|
|
|
|
website = models.CharField(blank=True, max_length=JNF_TEXT_MAX_CHARACTER_COUNT)
|
|
|
|
is_company_details_pdf = models.BooleanField(blank=False, default=False)
|
|
|
|
company_details_pdf_names = ArrayField(
|
|
|
|
models.CharField(null=True, default=None, max_length=JNF_TEXT_MAX_CHARACTER_COUNT), size=5,
|
|
|
|
default=list, blank=True)
|
|
|
|
company_details = models.CharField(max_length=JNF_TEXTAREA_MAX_CHARACTER_COUNT, default=None, null=True, blank=True)
|
|
|
|
#Company Address
|
|
|
|
address = models.CharField(blank=False, max_length=JNF_TEXTAREA_MAX_CHARACTER_COUNT)
|
|
|
|
city = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="")
|
2023-07-25 00:34:39 +05:30
|
|
|
city_type = models.CharField(blank=True, max_length=15, choices=OFFER_CITY_TYPE)
|
2023-07-24 19:00:52 +05:30
|
|
|
state = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="")
|
|
|
|
country = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="")
|
|
|
|
pin_code = models.IntegerField(blank=False, default=None, null=True)
|
|
|
|
company_type = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT)
|
|
|
|
nature_of_business = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="")
|
|
|
|
#Internship Details
|
|
|
|
is_description_pdf = models.BooleanField(blank=False, default=False)
|
|
|
|
description_pdf_names = ArrayField(
|
|
|
|
models.CharField(null=True, default=None, max_length=JNF_TEXT_MAX_CHARACTER_COUNT), size=5, default=list,
|
|
|
|
blank=True)
|
|
|
|
designation = models.CharField(blank=False, max_length=JNF_TEXT_MAX_CHARACTER_COUNT, default="")
|
|
|
|
description = models.CharField(blank=False, max_length=JNF_TEXTAREA_MAX_CHARACTER_COUNT, default=None, null=True)
|
|
|
|
location = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="")
|
|
|
|
season = ArrayField(
|
|
|
|
models.CharField(choices=SEASON_CHOICES, max_length=10, blank=False),
|
|
|
|
size=INF_TOTAL_SEASONS,
|
|
|
|
default=list
|
|
|
|
)
|
|
|
|
interning_period_from = models.DateField(blank=False, default=None, null=True)
|
|
|
|
interning_period_to = models.DateField(blank=False, default=None, null=True)
|
|
|
|
is_work_from_home = models.BooleanField(blank=False, default=False)
|
2023-07-25 00:34:39 +05:30
|
|
|
allowed_branch = ArrayField(
|
|
|
|
models.CharField(choices=BRANCH_CHOICES, blank=False, max_length=10),
|
|
|
|
size=TOTAL_BRANCHES,
|
|
|
|
default=list
|
|
|
|
)
|
2023-10-03 01:47:26 +05:30
|
|
|
allowed_batch = ArrayField(
|
|
|
|
models.CharField(max_length=10, choices=BATCH_CHOICES),
|
|
|
|
size=TOTAL_BATCHES,
|
|
|
|
default=list
|
|
|
|
)
|
2024-07-19 11:56:33 +05:30
|
|
|
eligiblestudents = ArrayField(
|
|
|
|
models.CharField(choices=ELIGIBLE_CHOICES, blank=False, max_length=10),
|
|
|
|
size=10,
|
|
|
|
default=list
|
|
|
|
)
|
2024-06-21 00:15:00 +05:30
|
|
|
tentative_no_of_offers = models.IntegerField(blank=False, default=None, null=True)
|
|
|
|
company_turnover = models.IntegerField(blank=True, default=None, null=True) # newly added field
|
|
|
|
establishment_date = models.DateField(blank=True, default=None, null=True) # newly added field
|
|
|
|
expected_no_of_offers = models.IntegerField(blank=True , default=None , null=True) # newly added
|
|
|
|
number_of_employees = models.IntegerField(blank=True, default=None, null=True) # newly added field
|
|
|
|
pwd_eligible = models.BooleanField(blank=True, default=False) #newly added field
|
|
|
|
backlog_eligible = models.BooleanField(blank=True, default=False) #newly added field
|
|
|
|
psychometric_test = models.BooleanField(blank=True, default=False) #newly added field
|
|
|
|
medical_test = models.BooleanField(blank=True, default=False) #newly added field
|
|
|
|
cpi_eligible = models.DecimalField(decimal_places=2, default=0.00, max_digits=4) #newly added field
|
2023-07-24 19:00:52 +05:30
|
|
|
is_stipend_description_pdf = models.BooleanField(blank=False, default=False)
|
|
|
|
stipend_description_pdf_names=ArrayField(
|
|
|
|
models.CharField(null=True, default=None, max_length=JNF_TEXT_MAX_CHARACTER_COUNT), size=5, default=list,
|
|
|
|
blank=True)
|
|
|
|
stipend=models.IntegerField(blank=False, default=None, null=True)
|
|
|
|
facilities_provided=ArrayField(
|
2023-08-05 02:10:41 +05:30
|
|
|
models.CharField(null=True, choices=INF_FACILITIES_PROVIDED, max_length=20),
|
2023-07-24 19:00:52 +05:30
|
|
|
size=INF_TOTAL_FACILITIES,
|
2023-08-05 02:10:41 +05:30
|
|
|
default=list,
|
|
|
|
blank=True
|
2023-07-24 19:00:52 +05:30
|
|
|
)
|
2023-10-03 01:47:26 +05:30
|
|
|
additional_info = ArrayField(models.CharField(blank=True, max_length=JNF_TEXTMEDIUM_MAX_CHARACTER_COUNT), size=15,
|
|
|
|
default=list, blank=True)
|
|
|
|
offer_accepted = models.BooleanField(blank=False, default=None, null=True)
|
|
|
|
deadline_datetime = models.DateTimeField(blank=False, verbose_name="Deadline Date", default=two_day_after_today)
|
|
|
|
|
2023-07-24 19:00:52 +05:30
|
|
|
additional_facilities = models.CharField(blank=True, max_length=JNF_TEXTAREA_MAX_CHARACTER_COUNT, default=None, null=True)
|
|
|
|
academic_requirements = models.CharField(blank=True, max_length=JNF_TEXTAREA_MAX_CHARACTER_COUNT, default=None, null=True)
|
|
|
|
# selection process
|
|
|
|
selection_procedure_rounds = ArrayField(
|
|
|
|
models.CharField(null=True, default=None, max_length=JNF_TEXT_MAX_CHARACTER_COUNT), size=10,
|
|
|
|
default=list, blank=True)
|
|
|
|
selection_procedure_details = models.CharField(blank=True, max_length=JNF_TEXTAREA_MAX_CHARACTER_COUNT)
|
|
|
|
selection_procedure_details_pdf_names = ArrayField(
|
|
|
|
models.CharField(null=True, default=None, max_length=JNF_TEXT_MAX_CHARACTER_COUNT),
|
|
|
|
size=5, default=list, blank=True)
|
|
|
|
is_selection_procedure_details_pdf = models.BooleanField(blank=False, default=False)
|
|
|
|
#contact details of company person
|
|
|
|
contact_person_name = models.CharField(blank=False, max_length=JNF_TEXT_MAX_CHARACTER_COUNT)
|
2024-08-04 17:25:53 +05:30
|
|
|
phone_number = models.CharField(max_length=15, blank=False)
|
2023-07-24 19:00:52 +05:30
|
|
|
email = models.EmailField(blank=False)
|
2023-07-25 09:47:59 +05:30
|
|
|
# contact_person_designation = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="")
|
|
|
|
# telephone_number = models.PositiveBigIntegerField(blank=True, default=None, null=True)
|
2023-07-24 19:00:52 +05:30
|
|
|
email_verified = models.BooleanField(blank=False, default=False)
|
|
|
|
#history
|
|
|
|
created_at = models.DateTimeField(blank=False, default=None, null=True)
|
|
|
|
updated_at = models.DateTimeField(blank=False, default=None, null=True)
|
|
|
|
changed_by = models.ForeignKey(User, on_delete=models.RESTRICT, blank=True, null=True)
|
|
|
|
history = HistoricalRecords(user_model=User)
|
|
|
|
|
|
|
|
|
|
|
|
def format(self):
|
|
|
|
if self.company_name is not None:
|
|
|
|
self.company_name = self.company_name.strip()[:JNF_SMALLTEXT_MAX_CHARACTER_COUNT]
|
|
|
|
if self.company_type is not None:
|
|
|
|
self.company_type = self.company_type.strip()[:JNF_SMALLTEXT_MAX_CHARACTER_COUNT]
|
|
|
|
if self.company_details is not None:
|
|
|
|
self.company_details = self.company_details.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
|
|
|
if self.address is not None:
|
|
|
|
self.address = self.address.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
|
|
|
if self.nature_of_business is not None:
|
|
|
|
self.nature_of_business = self.nature_of_business.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
|
|
|
if self.website is not None:
|
|
|
|
self.website = self.website.strip()[:JNF_TEXT_MAX_CHARACTER_COUNT]
|
|
|
|
if self.contact_person_name is not None:
|
|
|
|
self.contact_person_name = self.contact_person_name.strip()[:JNF_TEXT_MAX_CHARACTER_COUNT]
|
|
|
|
if self.city is not None:
|
|
|
|
self.city = self.city.strip()[:JNF_SMALLTEXT_MAX_CHARACTER_COUNT]
|
|
|
|
if self.state is not None:
|
|
|
|
self.state = self.state.strip()[:JNF_SMALLTEXT_MAX_CHARACTER_COUNT]
|
|
|
|
if self.country is not None:
|
|
|
|
self.country = self.country.strip()[:JNF_SMALLTEXT_MAX_CHARACTER_COUNT]
|
|
|
|
if self.city_type is not None:
|
|
|
|
self.city_type = self.city_type.strip()[:JNF_SMALLTEXT_MAX_CHARACTER_COUNT]
|
|
|
|
if self.selection_procedure_details is not None:
|
|
|
|
self.selection_procedure_details = self.selection_procedure_details.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
|
|
|
if self.description is not None:
|
|
|
|
self.description = self.description.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
|
|
|
if self.additional_facilities is not None:
|
|
|
|
self.additional_facilities = self.additional_facilities.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
|
|
|
if self.academic_requirements is not None:
|
|
|
|
self.academic_requirements = self.academic_requirements.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
2023-10-03 01:47:26 +05:30
|
|
|
if self.additional_info is not None:
|
|
|
|
self.additional_info = [info.strip()[:JNF_TEXTMEDIUM_MAX_CHARACTER_COUNT] for info in
|
|
|
|
list(self.additional_info)]
|
2023-07-25 09:47:59 +05:30
|
|
|
# if self.contact_person_designation is not None:
|
|
|
|
# self.contact_person_designation = self.contact_person_designation.strip()[:JNF_SMALLTEXT_MAX_CHARACTER_COUNT]
|
2023-07-24 19:00:52 +05:30
|
|
|
|
|
|
|
@property
|
|
|
|
def _history_user(self):
|
|
|
|
return self.changed_by
|
|
|
|
|
|
|
|
@_history_user.setter
|
|
|
|
def _history_user(self, value):
|
|
|
|
if isinstance(value, User):
|
|
|
|
self.changed_by = value
|
|
|
|
else:
|
|
|
|
self.changed_by = None
|
|
|
|
|
|
|
|
def save(self, *args, **kwargs):
|
|
|
|
''' On save, add timestamps '''
|
|
|
|
if not self.created_at:
|
|
|
|
self.created_at = timezone.now()
|
|
|
|
self.format()
|
|
|
|
self.updated_at = timezone.now()
|
|
|
|
return super(Internship, self).save(*args, **kwargs)
|
|
|
|
|
|
|
|
def __str__(self):
|
2023-08-05 02:10:41 +05:30
|
|
|
return self.company_name + " - " + self.designation
|
|
|
|
|
|
|
|
|
|
|
|
class InternshipApplication(models.Model):
|
|
|
|
id = models.CharField(blank=False, primary_key=True, max_length=15)
|
|
|
|
internship = models.ForeignKey(Internship, blank=False, on_delete=models.RESTRICT, default=None, null=True)
|
|
|
|
student = models.ForeignKey(Student, blank=False, on_delete=models.CASCADE)
|
|
|
|
resume = models.CharField(max_length=JNF_TEXT_MAX_CHARACTER_COUNT, blank=False, null=True, default=None)
|
|
|
|
additional_info = models.JSONField(blank=True, null=True, default=None)
|
|
|
|
selected = models.BooleanField(null=True, default=None, blank=True)
|
2023-10-03 22:17:00 +05:30
|
|
|
offer_accepted = models.BooleanField(null=True, default=None, blank=True) # True if offer accepted, False if rejected, None if not yet decided
|
2023-08-05 02:10:41 +05:30
|
|
|
stipend = models.IntegerField(blank=True, default=None, null=True)
|
|
|
|
applied_at = models.DateTimeField(blank=False, default=None, null=True)
|
|
|
|
updated_at = models.DateTimeField(blank=False, default=None, null=True)
|
|
|
|
changed_by = models.ForeignKey(User, blank=False, on_delete=models.RESTRICT, default=None, null=True)
|
|
|
|
history = HistoricalRecords(user_model=User)
|
|
|
|
|
|
|
|
def save(self, *args, **kwargs):
|
|
|
|
''' On save, add timestamps '''
|
|
|
|
if not self.applied_at:
|
|
|
|
self.applied_at = timezone.now()
|
|
|
|
self.updated_at = timezone.now()
|
|
|
|
|
|
|
|
return super(InternshipApplication, self).save(*args, **kwargs)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def _history_user(self):
|
|
|
|
return self.changed_by
|
|
|
|
|
|
|
|
@_history_user.setter
|
|
|
|
def _history_user(self, value):
|
|
|
|
if isinstance(value, User):
|
|
|
|
self.changed_by = value
|
|
|
|
else:
|
|
|
|
self.changed_by = None
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
verbose_name_plural = "Internship Applications"
|
|
|
|
unique_together = ('internship_id', 'student_id')
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.internship.company_name + " - " + self.student.name
|
2023-07-24 19:00:52 +05:30
|
|
|
|
2022-11-03 16:46:56 +05:30
|
|
|
|
|
|
|
class Contributor(models.Model):
|
|
|
|
id = models.AutoField(primary_key=True)
|
|
|
|
name = models.CharField(max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, blank=False, default="")
|
|
|
|
email = models.EmailField(max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, blank=False, default="", unique=True)
|
|
|
|
github_id = models.CharField(max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, blank=False, default="", unique=True)
|
|
|
|
linkedin = models.CharField(max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, unique=True, null=True)
|
|
|
|
commits = models.IntegerField(blank=False, default=0)
|
|
|
|
image = models.CharField(max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, blank=False, default="", null=True)
|
|
|
|
|
|
|
|
def __str__(self):
|
2023-10-03 16:33:11 +05:30
|
|
|
return self.name
|
|
|
|
|
|
|
|
|
|
|
|
class Issues(models.Model):
|
|
|
|
id = models.AutoField(primary_key=True)
|
|
|
|
title = models.CharField(max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, blank=False, default="")
|
|
|
|
description = models.CharField(max_length=200, blank=False, default="")
|
2023-10-03 19:14:10 +05:30
|
|
|
#opening=(models.ForeignKey(Placement, on_delete=models.CASCADE, blank=False) or models.ForeignKey(Internship, on_delete=models.CASCADE, blank=False))
|
|
|
|
opening_id=models.CharField(blank=False, max_length=15, default=None, null=True)
|
|
|
|
opening_type=models.CharField(choices=[('Placement','Placement'),('Internship','Internship')], blank=False, max_length=15, default=PLACEMENT)
|
2023-10-03 16:33:11 +05:30
|
|
|
#status = models.CharField(max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, blank=False, default="")
|
|
|
|
student=models.ForeignKey(Student, on_delete=models.CASCADE, blank=False)
|
|
|
|
created_at = models.DateTimeField(blank=False, default=None, null=True)
|
|
|
|
updated_at = models.DateTimeField(blank=False, default=None, null=True)
|
|
|
|
changed_by = models.ForeignKey(User, on_delete=models.RESTRICT, blank=True, null=True)
|
|
|
|
history = HistoricalRecords(user_model=User)
|
|
|
|
|
|
|
|
def save(self, *args, **kwargs):
|
|
|
|
''' On save, add timestamps '''
|
|
|
|
if not self.created_at:
|
|
|
|
self.created_at = timezone.now()
|
|
|
|
self.updated_at = timezone.now()
|
|
|
|
|
|
|
|
return super(Issues, self).save(*args, **kwargs)
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.title + " - " + self.student.name
|
|
|
|
class Meta:
|
|
|
|
verbose_name_plural = "Issues"
|
|
|
|
|