Improve admin email logging

This commit is contained in:
PCoder 2019-09-24 10:34:04 +05:30
parent 8cd7a69162
commit cc03c11c4a

View file

@ -1558,6 +1558,7 @@ class VirtualMachineView(LoginRequiredMixin, View):
# Cancel Stripe subscription # Cancel Stripe subscription
stripe_utils = StripeUtils() stripe_utils = StripeUtils()
hosting_order = None
try: try:
hosting_order = HostingOrder.objects.get( hosting_order = HostingOrder.objects.get(
vm_id=vm.id vm_id=vm.id
@ -1643,6 +1644,11 @@ class VirtualMachineView(LoginRequiredMixin, View):
email = BaseEmail(**email_data) email = BaseEmail(**email_data)
email.send() email.send()
admin_email_body.update(response) admin_email_body.update(response)
admin_email_body["customer_email"] = owner.email
admin_email_body["VM_ID"] = vm.id
admin_email_body["VM_created_at"] = (str(hosting_order.created_at) if
hosting_order is not None
else "unknown")
admin_msg_sub = "VM and Subscription for VM {} and user: {}".format( admin_msg_sub = "VM and Subscription for VM {} and user: {}".format(
vm.id, vm.id,
owner.email owner.email