def view(request, key): order = Order.get(key) if not order: redirect('/cart/admin/all/') total_price = 0 for order_item in order.order_items: total_price = order_item.count * order_item.gift_id.price return render_to_response('cart/admin/view.html', {'order':order, 'total_price':total_price})
def send_order_to_manager(request, order_key): order = Order.get(order_key) subject = render_to_string('cart/notifications/order2manager_subject.html', {'order_id':order.key().id()}) subject = ''.join(subject.splitlines()) message = render_to_string('cart/notifications/order2manager_body.html', {'order': order}) email = mail.EmailMessage() email.subject = subject email.html = message email.sender = settings.DEFAULT_MAIL_FROM managers = DatastoreUser.all() for manager in managers: if manager.email: email.to = manager.email email.send() return Response("OK")
def delete_order(request, key): order = Order.get(key) if order: order.delete() return redirect('/cart/admin/all')