mirror of
https://github.com/lemeow125/DRF_Template.git
synced 2025-04-28 02:31:15 +08:00
Fixed email templates failing to load and updated README.md
This commit is contained in:
parent
8d40a33882
commit
fe59d3883a
4 changed files with 21 additions and 12 deletions
|
@ -87,7 +87,7 @@ EMAIL_HOST = get_secret('EMAIL_HOST')
|
|||
EMAIL_HOST_USER = get_secret('EMAIL_HOST_USER')
|
||||
EMAIL_HOST_PASSWORD = get_secret('EMAIL_HOST_PASSWORD')
|
||||
EMAIL_PORT = get_secret('EMAIL_PORT')
|
||||
EMAIL_USE_TLS = get_secret('EMAIL_USE_TLS')
|
||||
EMAIL_USE_TLS = (get_secret('EMAIL_USE_TLS') == 'True')
|
||||
EMAIL_ADDRESS = (get_secret('EMAIL_ADDRESS') == 'True')
|
||||
|
||||
# Application definition
|
||||
|
@ -183,7 +183,7 @@ TEMPLATES = [
|
|||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [
|
||||
BASE_DIR / 'templates',
|
||||
BASE_DIR / 'emails/templates/',
|
||||
],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
|
|
|
@ -3,15 +3,15 @@ from django.utils import timezone
|
|||
|
||||
|
||||
class ActivationEmail(email.ActivationEmail):
|
||||
template_name = 'templates/email_activation.html'
|
||||
template_name = 'email_activation.html'
|
||||
|
||||
|
||||
class PasswordResetEmail(email.PasswordResetEmail):
|
||||
template_name = 'templates/password_change.html'
|
||||
template_name = 'password_change.html'
|
||||
|
||||
|
||||
class SubscriptionAvailedEmail(email.BaseEmailMessage):
|
||||
template_name = "templates/subscription_availed.html"
|
||||
template_name = "subscription_availed.html"
|
||||
|
||||
def get_context_data(self):
|
||||
context = super().get_context_data()
|
||||
|
@ -25,7 +25,7 @@ class SubscriptionAvailedEmail(email.BaseEmailMessage):
|
|||
|
||||
|
||||
class SubscriptionRefundedEmail(email.BaseEmailMessage):
|
||||
template_name = "templates/subscription_refunded.html"
|
||||
template_name = "subscription_refunded.html"
|
||||
|
||||
def get_context_data(self):
|
||||
context = super().get_context_data()
|
||||
|
@ -38,7 +38,7 @@ class SubscriptionRefundedEmail(email.BaseEmailMessage):
|
|||
|
||||
|
||||
class SubscriptionCancelledEmail(email.BaseEmailMessage):
|
||||
template_name = "templates/subscription_cancelled.html"
|
||||
template_name = "subscription_cancelled.html"
|
||||
|
||||
def get_context_data(self):
|
||||
context = super().get_context_data()
|
||||
|
|
|
@ -135,10 +135,9 @@ def stripe_webhook_view(request):
|
|||
if event['type'] == 'customer.subscription.created':
|
||||
subscription = event['data']['object']
|
||||
# Get the Invoice object from the Subscription object
|
||||
invoice = stripe.Invoice.retrieve(subscription['latest_invoice'])[
|
||||
'data']['object']
|
||||
invoice = stripe.Invoice.retrieve(subscription['latest_invoice'])
|
||||
# Get the Charge object from the Invoice object
|
||||
charge = stripe.Charge.retrieve(invoice['charge'])['data']['object']
|
||||
charge = stripe.Charge.retrieve(invoice['charge'])
|
||||
|
||||
# Get paying user
|
||||
customer = stripe.Customer.retrieve(subscription["customer"])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue