mirror of
https://github.com/lemeow125/DRF_Template.git
synced 2025-06-29 00:25:44 +08:00
Overhauled entire project config, added notifications, email templates, optimized stripe subscriptions, redis caching, and webdriver utilities
This commit is contained in:
parent
7cbe8fd720
commit
99dfcef67b
84 changed files with 4300 additions and 867 deletions
49
backend/emails/templates.py
Normal file
49
backend/emails/templates.py
Normal file
|
@ -0,0 +1,49 @@
|
|||
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
|
Loading…
Add table
Add a link
Reference in a new issue