|
@@ -127,9 +127,11 @@ class MealManage(View):
|
|
|
line = int(request_dict.get('line', None))
|
|
|
if page is None or line is None:
|
|
|
return response.json(444)
|
|
|
+
|
|
|
qs = Store_Meal.objects.values("id", "title", "price", "content", "day", "add_time", "update_time", "currency"
|
|
|
- , "bucket_id", "bucket__bucket", "bucket__area", "commodity_type", "commodity_code",
|
|
|
- "bucket__storeDay", "virtual_price", "is_discounts", "discount_price", "discount_content", "expire", "symbol")
|
|
|
+ , "bucket_id", "commodity_type", "commodity_code", "virtual_price", "is_discounts"
|
|
|
+ , "discount_price", "discount_content", "expire", "symbol"
|
|
|
+ , "bucket__bucket", "bucket__area", "bucket__storeDay")
|
|
|
res = {}
|
|
|
if qs.exists():
|
|
|
ql = list(qs)
|
|
@@ -137,16 +139,13 @@ class MealManage(View):
|
|
|
from itertools import groupby
|
|
|
ql.sort(key=itemgetter('bucket__area'))
|
|
|
ql=CommonService.qs_to_list(ql[(page - 1) * line:page * line])
|
|
|
- for area, items in groupby(ql, key=itemgetter('bucket__area')):
|
|
|
- items_list = list(items)
|
|
|
- for key, val in enumerate(items_list):
|
|
|
- pay_types = Pay_Type.objects.filter(store_meal=items_list[key]['id']).values("id", "payment")
|
|
|
- items_list[key]['pay_type'] = list(pay_types)
|
|
|
-
|
|
|
-
|
|
|
- res['count'] = len(ql)
|
|
|
- res['data'] = items_list
|
|
|
-
|
|
|
+ # for area, items in groupby(ql, key=itemgetter('bucket__area')):
|
|
|
+ items_list = list(ql)
|
|
|
+ for key, val in enumerate(items_list):
|
|
|
+ pay_types = Pay_Type.objects.filter(store_meal=items_list[key]['id']).values("id", "payment")
|
|
|
+ items_list[key]['pay_type'] = list(pay_types)
|
|
|
+ res['count'] = len(ql)
|
|
|
+ res['data'] = items_list
|
|
|
return response.json(0, res)
|
|
|
|
|
|
def update(self, request_dict, userID, response):
|