Merge pull request #652 from pcoder/bugfix/send_email_on_dg_subscription
Send email to admin on dg subscription
This commit is contained in:
commit
fbfa6c8d21
3 changed files with 38 additions and 1 deletions
25
digitalglarus/migrations/0026_auto_20180824_0739.py
Normal file
25
digitalglarus/migrations/0026_auto_20180824_0739.py
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.9.4 on 2018-08-24 07:39
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('digitalglarus', '0025_membershiporder_stripe_subscription_id'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='bookingorder',
|
||||||
|
name='cc_brand',
|
||||||
|
field=models.CharField(blank=True, max_length=128),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='membershiporder',
|
||||||
|
name='cc_brand',
|
||||||
|
field=models.CharField(blank=True, max_length=128),
|
||||||
|
),
|
||||||
|
]
|
|
@ -39,7 +39,7 @@ class Ordereable(models.Model):
|
||||||
created_at = models.DateTimeField(auto_now_add=True)
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
approved = models.BooleanField(default=False)
|
approved = models.BooleanField(default=False)
|
||||||
last4 = models.CharField(max_length=4, blank=True)
|
last4 = models.CharField(max_length=4, blank=True)
|
||||||
cc_brand = models.CharField(max_length=10, blank=True)
|
cc_brand = models.CharField(max_length=128, blank=True)
|
||||||
stripe_charge_id = models.CharField(max_length=100, null=True)
|
stripe_charge_id = models.CharField(max_length=100, null=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -492,6 +492,18 @@ class MembershipPaymentView(LoginRequiredMixin, IsNotMemberMixin, FormView):
|
||||||
'membership_dates': membership.type.first_month_formated_range
|
'membership_dates': membership.type.first_month_formated_range
|
||||||
})
|
})
|
||||||
|
|
||||||
|
email_to_admin_data = {
|
||||||
|
'subject': "New Digital Glarus subscription: {user}".format(
|
||||||
|
user=self.request.user.email
|
||||||
|
),
|
||||||
|
'from_email': 'info@digitalglarus.ch',
|
||||||
|
'to': ['info@ungleich.ch'],
|
||||||
|
'body': "\n".join(
|
||||||
|
["%s=%s" % (k, v) for (k, v) in
|
||||||
|
order_data.items()]),
|
||||||
|
}
|
||||||
|
send_plain_email_task.delay(email_to_admin_data)
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
'membership': membership,
|
'membership': membership,
|
||||||
'order': membership_order,
|
'order': membership_order,
|
||||||
|
|
Loading…
Reference in a new issue