chanjunkai 5 years ago
parent
commit
2a811fe794
1 changed files with 6 additions and 8 deletions
  1. 6 8
      Controller/CloudStorage.py

+ 6 - 8
Controller/CloudStorage.py

@@ -103,16 +103,14 @@ class CloudStorageView(View):
 
     def do_commodity_list(self, request_dict, userID, response):
         mold = request_dict.get('mold', None)
+        qs = Store_Meal.objects
         if mold:
-            qs = Store_Meal.objects.filter(bucket__mold=1). \
-                values("id", "title", "content", "price", "day",
-                       "currency","bucket__storeDay", "bucket__bucket",
-                       "bucket__area", "type")
+            qs = qs.filter(bucket__mold=1)
         else:
-            qs = Store_Meal.objects.filter(bucket__mold=0). \
-                values("id", "title", "content", "price", "day",
-                       "currency", "bucket__storeDay", "bucket__bucket",
-                       "bucket__area", "type")
+            qs = qs.filter(bucket__mold=0)
+        qs = qs.values("id", "title", "content", "price",
+                       "day", "currency","bucket__storeDay",
+                       "bucket__bucket", "bucket__area", "type","commodity_code","commodity_type")
         if qs.exists():
             ql = list(qs)
             from operator import itemgetter