mirror of
https://github.com/lemeow125/DRF_Template.git
synced 2024-11-17 04:09:25 +08:00
50 lines
1.7 KiB
Python
50 lines
1.7 KiB
Python
|
from djoser import email
|
||
|
from django.utils import timezone
|
||
|
|
||
|
|
||
|
class ActivationEmail(email.ActivationEmail):
|
||
|
template_name = 'templates/email_activation.html'
|
||
|
|
||
|
|
||
|
class PasswordResetEmail(email.PasswordResetEmail):
|
||
|
template_name = 'templates/password_change.html'
|
||
|
|
||
|
|
||
|
class SubscriptionAvailedEmail(email.BaseEmailMessage):
|
||
|
template_name = "templates/subscription_availed.html"
|
||
|
|
||
|
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")
|
||
|
context['date'] = timezone.now().strftime("%B %d, %I:%M %p")
|
||
|
context.update(self.context)
|
||
|
return context
|
||
|
|
||
|
|
||
|
class SubscriptionRefundedEmail(email.BaseEmailMessage):
|
||
|
template_name = "templates/subscription_refunded.html"
|
||
|
|
||
|
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")
|
||
|
context['date'] = timezone.now().strftime("%B %d, %I:%M %p")
|
||
|
context.update(self.context)
|
||
|
return context
|
||
|
|
||
|
|
||
|
class SubscriptionCancelledEmail(email.BaseEmailMessage):
|
||
|
template_name = "templates/subscription_cancelled.html"
|
||
|
|
||
|
def get_context_data(self):
|
||
|
context = super().get_context_data()
|
||
|
context["user"] = context.get("user")
|
||
|
context["subscription_plan"] = context.get("subscription_plan")
|
||
|
context['date'] = timezone.now().strftime("%B %d, %I:%M %p")
|
||
|
context.update(self.context)
|
||
|
return context
|