def get(self, **kwargs): user = self.auth_current_user products = self.get_cart_content() total = calculate_total_price(products) context = { 'user': user, 'form': self.form, 'products': products, 'total': total, 'format_currency': i18n.format_currency, } return self.render_response('shop/order.html', **context)
def get(self, **kwargs): products = self.session.get('products') language = self.get_locale() total = calculate_total_price(products) context = { 'products': products, 'language': language, 'format_currency': i18n.format_currency, 'total': total, } return self.render_response('shop/cart.html', **context)
def get_id(self, id): query = self.get_by_id(id) logging.warn(query) items = make_list_from_string(query.items) total = calculate_total_price(items) order = { 'id': query.key().id(), 'products': items, 'total': total, 'delivery': self.get_formatted_address(query), 'posted': query.date, 'area': query.delivery_area, } order_info = [ query, order ] return order_info
def get_orders_by_user(self, user_key=None): query = self.all() query.filter('user ='******'products': items, 'total': total, 'delivery': self.get_formatted_address(order), 'posted': order.date, 'delivered': order.delivered, } orders.append(order_item) return orders
def get_undelivered_orders(self): query = self.all() query.filter('delivered =', False) query.order('-date') result = query.fetch(100) if result is None: return [] orders = [] order_item = {} for order in result: items = make_list_from_string(order.items) total = calculate_total_price(items) order_item = { 'id': order.key().id(), 'products': items, 'total': total, 'posted': order.date, } orders.append(order_item) logging.warn(orders) return orders