2024-05-10 23:15:29 +08:00
|
|
|
from djoser import email
|
|
|
|
from django.utils import timezone
|
|
|
|
|
|
|
|
|
|
|
|
class ActivationEmail(email.ActivationEmail):
|
2024-10-30 22:09:58 +08:00
|
|
|
template_name = "email_activation.html"
|
2024-05-10 23:15:29 +08:00
|
|
|
|
|
|
|
|
|
|
|
class PasswordResetEmail(email.PasswordResetEmail):
|
2024-10-30 22:09:58 +08:00
|
|
|
template_name = "password_change.html"
|
2024-05-10 23:15:29 +08:00
|
|
|
|
|
|
|
|
|
|
|
class SubscriptionAvailedEmail(email.BaseEmailMessage):
|
2024-05-10 23:46:48 +08:00
|
|
|
template_name = "subscription_availed.html"
|
2024-05-10 23:15:29 +08:00
|
|
|
|
|
|
|
def get_context_data(self):
|
|
|
|
context = super().get_context_data()
|
|
|
|
context["user"] = context.get("user")
|
|
|
|
context["subscription_plan"] = context.get("subscription_plan")
|
|
|
|
context["subscription"] = context.get("subscription")
|
|
|
|
context["price_paid"] = context.get("price_paid")
|
2024-10-30 22:09:58 +08:00
|
|
|
context["date"] = timezone.now().strftime("%B %d, %I:%M %p")
|
2024-05-10 23:15:29 +08:00
|
|
|
context.update(self.context)
|
|
|
|
return context
|
|
|
|
|
|
|
|
|
|
|
|
class SubscriptionRefundedEmail(email.BaseEmailMessage):
|
2024-05-10 23:46:48 +08:00
|
|
|
template_name = "subscription_refunded.html"
|
2024-05-10 23:15:29 +08:00
|
|
|
|
|
|
|
def get_context_data(self):
|
|
|
|
context = super().get_context_data()
|
|
|
|
context["user"] = context.get("user")
|
|
|
|
context["subscription_plan"] = context.get("subscription_plan")
|
|
|
|
context["refund"] = context.get("refund")
|
2024-10-30 22:09:58 +08:00
|
|
|
context["date"] = timezone.now().strftime("%B %d, %I:%M %p")
|
2024-05-10 23:15:29 +08:00
|
|
|
context.update(self.context)
|
|
|
|
return context
|
|
|
|
|
|
|
|
|
|
|
|
class SubscriptionCancelledEmail(email.BaseEmailMessage):
|
2024-05-10 23:46:48 +08:00
|
|
|
template_name = "subscription_cancelled.html"
|
2024-05-10 23:15:29 +08:00
|
|
|
|
|
|
|
def get_context_data(self):
|
|
|
|
context = super().get_context_data()
|
|
|
|
context["user"] = context.get("user")
|
|
|
|
context["subscription_plan"] = context.get("subscription_plan")
|
2024-10-30 22:09:58 +08:00
|
|
|
context["date"] = timezone.now().strftime("%B %d, %I:%M %p")
|
2024-05-10 23:15:29 +08:00
|
|
|
context.update(self.context)
|
|
|
|
return context
|