def summary(request, year=None, month=None, day=None): orders = None if year == None and month == None and day == None: orders = Order.today() else: orders = Order.by_date(year, month, day) orders = orders.select_related("meal", "restaurant", "order_for").order_by("restaurant", "for_user") # data for unorderd users ordered_user_set = set([order.for_user for order in orders]) all_user_set = set([user for user in User.objects.all()]) # is meal sys locked? locked = Lock.is_locked() orders_group_by_restaurant = _regroup_and_sum_orders(orders) return render_to_response( "meal/list.html", { "orders": orders, "orders_group_by_restaurant": orders_group_by_restaurant, "unordered_users": all_user_set - ordered_user_set, "locked": locked, }, context_instance=RequestContext(request), )
def new(*args, **kwargs): if Lock.is_locked(): return HttpResponseForbidden("订餐系统已经锁定") return meth(*args, **kwargs)