Explorar o código

套餐信息 title字段显示

chenshibin %!s(int64=4) %!d(string=hai) anos
pai
achega
3fe1218190
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  1. 7 1
      Controller/MealManage.py

+ 7 - 1
Controller/MealManage.py

@@ -13,6 +13,7 @@
 """
 """
 import traceback
 import traceback
 
 
+from django.db.models import F
 from django.utils import timezone
 from django.utils import timezone
 from django.utils.decorators import method_decorator
 from django.utils.decorators import method_decorator
 from django.views.decorators.csrf import csrf_exempt
 from django.views.decorators.csrf import csrf_exempt
@@ -132,10 +133,15 @@ class MealManage(View):
 
 
         page = int(request_dict.get('page', None))
         page = int(request_dict.get('page', None))
         line = int(request_dict.get('line', None))
         line = int(request_dict.get('line', None))
+        lang = int(request_dict.get('lang', None))
         if page is None or line is None:
         if page is None or line is None:
             return response.json(444)
             return response.json(444)
+        if not lang:
+            lang = 'cn'
 
 
-        qs = Store_Meal.objects.values("id", "price", "day", "add_time", "update_time", "currency"
+        qs = Store_Meal.objects.filter(lang__lang=lang)
+        qs = qs.annotate(title=F('lang__title'),content=F('lang__content'))
+        qs = qs.values("id", "price", "day", "add_time", "update_time", "currency"
                                        , "bucket_id", "commodity_type", "commodity_code", "virtual_price", "is_discounts"
                                        , "bucket_id", "commodity_type", "commodity_code", "virtual_price", "is_discounts"
                                        , "discount_price", "expire", "symbol"
                                        , "discount_price", "expire", "symbol"
                                        , "bucket__bucket", "bucket__area", "bucket__storeDay")
                                        , "bucket__bucket", "bucket__area", "bucket__storeDay")