mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-07-16 02:16:16 +00:00
jira-17 add junior and send invite mail
This commit is contained in:
51
junior/utils.py
Normal file
51
junior/utils.py
Normal file
@ -0,0 +1,51 @@
|
||||
"""Account utils"""
|
||||
"""Import django"""
|
||||
from django.conf import settings
|
||||
from rest_framework import viewsets, status
|
||||
from rest_framework.response import Response
|
||||
"""Third party Django app"""
|
||||
from templated_email import send_templated_mail
|
||||
import jwt
|
||||
import string
|
||||
from datetime import datetime
|
||||
from calendar import timegm
|
||||
from uuid import uuid4
|
||||
import secrets
|
||||
from rest_framework import serializers
|
||||
from junior.models import Junior
|
||||
from guardian.models import Guardian
|
||||
from account.models import UserDelete
|
||||
from base.messages import ERROR_CODE
|
||||
|
||||
|
||||
|
||||
def junior_notification_email(recipient_email, full_name, email, password):
|
||||
"""Notification email"""
|
||||
from_email = settings.EMAIL_FROM_ADDRESS
|
||||
recipient_list = [recipient_email]
|
||||
send_templated_mail(
|
||||
template_name='junior_notification_email.email',
|
||||
from_email=from_email,
|
||||
recipient_list=recipient_list,
|
||||
context={
|
||||
'full_name': full_name,
|
||||
'url':'link',
|
||||
'email': email,
|
||||
'password': password
|
||||
}
|
||||
)
|
||||
return full_name
|
||||
|
||||
def junior_approval_mail(guardian, full_name):
|
||||
"""junior approval mail"""
|
||||
from_email = settings.EMAIL_FROM_ADDRESS
|
||||
recipient_list = [guardian]
|
||||
send_templated_mail(
|
||||
template_name='junior_approval_mail.email',
|
||||
from_email=from_email,
|
||||
recipient_list=recipient_list,
|
||||
context={
|
||||
'full_name': full_name
|
||||
}
|
||||
)
|
||||
return full_name
|
Reference in New Issue
Block a user