def order_email(request, email, order_id): order = Order.objects.get(pk=order_id) order_details = [] grand_quantity_total = 0 grand_total = 0 for order_detail in order.order_details.all(): grand_quantity_total += order_detail.quantity grand_total += (order_detail.quantity * order_detail.price) order_details.append({ "pk": order_detail.pk, "quantity": order_detail.quantity, "style": order_detail.style, "size": order_detail.size, "description": order_detail.description, "sku": order_detail.sku, "price": order_detail.price, "total": order_detail.quantity * order_detail.price, }) data_object = { "image_path": settings.EMAIL_STATIC_URL, "order": order, "order_details": order_details, "grand_total": grand_total, "grand_quantity_total": grand_quantity_total, } email_subject = "Cobian Order" email_body = make_html_email('emails/order_email', data_object, context_instance=RequestContext(request)) return send_email(email_subject, email_body, email)
def send_pre_authorized_email(request, warranty): user_profile = request.user.userprofile email = user_profile.user.email emails = [email, warranty.email] email_subject = "Cobian Warranty Claim" email_body = make_html_email('emails/warranty_pre_authorized', {"warranty": warranty}, context_instance=RequestContext(request)) return send_email(email_subject, email_body, emails)