This commit is contained in:
Jaya Surya 2023-08-01 22:39:06 +05:30
parent e6e420ccea
commit 4239dbc76c
3 changed files with 15 additions and 9 deletions

View File

@ -184,14 +184,14 @@ class InternshipResources(resources.ModelResource):
class InternAdmin(ExportMixin, SimpleHistoryAdmin):
resource_class = InternshipResources
def save_model(self, request, obj, form, change):
# Check if email_verified field is being changed from False to True
if change and not obj._state.adding and obj.email_verified and form.initial.get('email_verified', False) != obj.email_verified:
# Run the send_email_for_opening function
send_email_for_opening(obj)
# Save the model as usual
super().save_model(request, obj, form, change)
# def save_model(self, request, obj, form, change):
# # Check if email_verified field is being changed from False to True
# if change and not obj._state.adding and obj.email_verified and form.initial.get('email_verified', False) != obj.email_verified:
# # Run the send_email_for_opening function
# send_email_for_opening(obj)
#
# # Save the model as usual
# super().save_model(request, obj, form, change)

View File

@ -1,5 +1,7 @@
import os
DEBUG = os.environ.get('DEBUG')
BRANCH_CHOICES = [
["CSE", "CSE"],
["EE", "EE"],

View File

@ -459,8 +459,12 @@ def send_email_for_opening(opening):
"company_name": opening.company_name,
}
if DEBUG:
emails = [opening.email]
else:
emails = [opening.email, CDC_MAIl_ADDRESS]
# Send the email
sendEmail([opening.email, CDC_MAIl_ADDRESS],
sendEmail(emails,
COMPANY_OPENING_SUBMITTED_TEMPLATE_SUBJECT.format(id=opening.id), data,
COMPANY_OPENING_SUBMITTED_TEMPLATE, attachment_jnf_respone)