changed cdc reps emails

This commit is contained in:
karthikmurakonda 2023-08-05 02:10:41 +05:30
parent c315759a81
commit 11225c6bc7
4 changed files with 63 additions and 15 deletions

View File

@ -123,7 +123,7 @@ class AdminAdmin(ExportMixin, SimpleHistoryAdmin):
@admin.register(Placement) @admin.register(Placement)
class Placement(AdminAdmin): class Placement(AdminAdmin):
list_display = (COMPANY_NAME, CONTACT_PERSON_NAME, PHONE_NUMBER, 'tier', 'compensation_CTC', 'email_verified', 'updated_at') list_display = (COMPANY_NAME, DESIGNATION , CONTACT_PERSON_NAME, PHONE_NUMBER, 'tier', 'compensation_CTC', 'email_verified', 'updated_at')
search_fields = (COMPANY_NAME, CONTACT_PERSON_NAME) search_fields = (COMPANY_NAME, CONTACT_PERSON_NAME)
ordering = ('updated_at', COMPANY_NAME, CONTACT_PERSON_NAME, 'tier', 'compensation_CTC') ordering = ('updated_at', COMPANY_NAME, CONTACT_PERSON_NAME, 'tier', 'compensation_CTC')
list_filter = ('tier',) list_filter = ('tier',)
@ -195,7 +195,7 @@ class InternAdmin(ExportMixin, SimpleHistoryAdmin):
@admin.register(Internship) @admin.register(Internship)
class Placement(InternAdmin): class Placement(InternAdmin):
list_display = (COMPANY_NAME, CONTACT_PERSON_NAME, PHONE_NUMBER, 'stipend', 'email_verified', 'updated_at') list_display = (COMPANY_NAME, DESIGNATION, CONTACT_PERSON_NAME, PHONE_NUMBER, 'stipend', 'email_verified', 'updated_at')
search_fields = (COMPANY_NAME, CONTACT_PERSON_NAME) search_fields = (COMPANY_NAME, CONTACT_PERSON_NAME)
ordering = ('updated_at', COMPANY_NAME, CONTACT_PERSON_NAME, 'stipend') ordering = ('updated_at', COMPANY_NAME, CONTACT_PERSON_NAME, 'stipend')

View File

@ -47,7 +47,14 @@ DEGREE_CHOICES = [
TOTAL_BRANCHES = 4 # Total No of Branches TOTAL_BRANCHES = 4 # Total No of Branches
TOTAL_BATCHES = 5 # Total No of Batches TOTAL_BATCHES = 5 # Total No of Batches
CDC_MAIl_ADDRESS = 'cdc@iitdh.ac.in' CDC_REPS_EMAILS = [
"cdc@iitdh.ac.in",
"cdcfic@iitdh.ac.in",
"priyanka.naga@iitdh.ac.in",
"bharathbn@iitdh.ac.in",
"naveenmb@iitdh.ac.in",
"sraut@iitdh.ac.in"
]
# To be Configured Properly # To be Configured Properly
CLIENT_ID = os.environ.get('GOOGLE_OAUTH_CLIENT_ID') # Google Login Client ID CLIENT_ID = os.environ.get('GOOGLE_OAUTH_CLIENT_ID') # Google Login Client ID
@ -228,6 +235,6 @@ INF_FACILITIES_PROVIDED = [
['Medical', 'Medical'], ['Medical', 'Medical'],
] ]
INF_TOTAL_SEASONS = 4 INF_TOTAL_SEASONS = len(SEASONS)
INF_TOTAL_FACILITIES = 4 INF_TOTAL_FACILITIES = len(FACILITIES_CHOICES)

View File

@ -211,7 +211,7 @@ class Placement(models.Model):
return super(Placement, self).save(*args, **kwargs) return super(Placement, self).save(*args, **kwargs)
def __str__(self): def __str__(self):
return self.company_name + " - " + self.id return self.company_name + " - " + self.designation
class PlacementApplication(models.Model): class PlacementApplication(models.Model):
@ -327,9 +327,10 @@ class Internship(models.Model):
blank=True) blank=True)
stipend=models.IntegerField(blank=False, default=None, null=True) stipend=models.IntegerField(blank=False, default=None, null=True)
facilities_provided=ArrayField( facilities_provided=ArrayField(
models.CharField(choices=INF_FACILITIES_PROVIDED, blank=False, max_length=20), models.CharField(null=True, choices=INF_FACILITIES_PROVIDED, max_length=20),
size=INF_TOTAL_FACILITIES, size=INF_TOTAL_FACILITIES,
default=list default=list,
blank=True
) )
additional_facilities = models.CharField(blank=True, max_length=JNF_TEXTAREA_MAX_CHARACTER_COUNT, default=None, null=True) 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) academic_requirements = models.CharField(blank=True, max_length=JNF_TEXTAREA_MAX_CHARACTER_COUNT, default=None, null=True)
@ -410,7 +411,47 @@ class Internship(models.Model):
return super(Internship, self).save(*args, **kwargs) return super(Internship, self).save(*args, **kwargs)
def __str__(self): def __str__(self):
return self.company_name + " - " + self.id 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)
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
class Contributor(models.Model): class Contributor(models.Model):

View File

@ -416,7 +416,7 @@ def exception_email(opening):
"html": pdfhtml, "html": pdfhtml,
} }
sendEmail(CDC_MAIl_ADDRESS, COMPANY_OPENING_ERROR_TEMPLATE.format(company_name=opening["company_name"]), data, sendEmail("cdc@iitdh.ac.in", COMPANY_OPENING_ERROR_TEMPLATE.format(company_name=opening["company_name"]), data,
COMPANY_OPENING_SUBMITTED_TEMPLATE, attachment_jnf_respone) COMPANY_OPENING_SUBMITTED_TEMPLATE, attachment_jnf_respone)
@ -448,7 +448,10 @@ def send_email_for_opening(opening):
# Prepare email data and attachment # Prepare email data and attachment
pdfhtml = opening_description_table_html(opening) pdfhtml = opening_description_table_html(opening)
if isinstance(opening, Placement):
name = opening.company_name + '_jnf_response.pdf' name = opening.company_name + '_jnf_response.pdf'
elif isinstance(opening, Internship):
name = opening.company_name + '_inf_response.pdf'
attachment_jnf_respone = { attachment_jnf_respone = {
"name": name, "name": name,
"html": pdfhtml, "html": pdfhtml,
@ -459,10 +462,7 @@ def send_email_for_opening(opening):
"company_name": opening.company_name, "company_name": opening.company_name,
} }
if DEBUG: emails = [opening.email] + CDC_REPS_EMAILS
emails = [opening.email]
else:
emails = [opening.email, CDC_MAIl_ADDRESS]
# Send the email # Send the email
sendEmail(emails, sendEmail(emails,
COMPANY_OPENING_SUBMITTED_TEMPLATE_SUBJECT.format(id=opening.designation, company=opening.company_name), data, COMPANY_OPENING_SUBMITTED_TEMPLATE_SUBJECT.format(id=opening.designation, company=opening.company_name), data,