From 737f86194f87e2ffcf4e1374f6bf770e850f4cab Mon Sep 17 00:00:00 2001 From: Ching Date: Sun, 13 Feb 2022 20:38:37 +0800 Subject: [PATCH] =?UTF-8?q?fix(recipe=20edit=20page):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E9=A3=9F=E6=9D=90=E5=90=8E=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E4=B8=AD=E6=96=87=E5=AD=97=E8=BF=98=E5=9C=A8?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=9B=E4=BF=AE=E6=94=B9=E8=8F=9C?= =?UTF-8?q?=E8=B0=B1=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3=E6=8C=89=20id=20?= =?UTF-8?q?=E5=80=92=E5=BA=8F=E6=8E=92=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复创建食材后创建弹窗中文字还在的问题;修改菜谱列表接口按 id 倒序排列 Signed-off-by: Ching --- frontend/src/components/recipe-mobile/recipe-edit.vue | 4 +++- recipe/views.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/recipe-mobile/recipe-edit.vue b/frontend/src/components/recipe-mobile/recipe-edit.vue index eab9d62..af50ad9 100644 --- a/frontend/src/components/recipe-mobile/recipe-edit.vue +++ b/frontend/src/components/recipe-mobile/recipe-edit.vue @@ -384,7 +384,9 @@ export default { message: '创建成功', forbidClick: true, duration: 800, - }) + }), + (this.ingredient_name = null), + (this.ingredient_unit = null) ) ); diff --git a/recipe/views.py b/recipe/views.py index 9f85401..9dad7e5 100644 --- a/recipe/views.py +++ b/recipe/views.py @@ -18,7 +18,7 @@ class RecipeAPI(viewsets.ModelViewSet): # authentication.SessionAuthentication, # authentication.BasicAuthentication) # permission_classes = (permissions.IsAuthenticated,) - queryset = recipe.models.Recipe.objects.all() + queryset = recipe.models.Recipe.objects.order_by('-id') serializer_class = recipe.serializers.RecipeSerializer def perform_destroy(self, instance): @@ -54,7 +54,7 @@ class RecipeAPI(viewsets.ModelViewSet): return super().perform_update(serializer) def list(self, request, *args, **kwargs): - self.queryset = recipe.models.Recipe.objects.exclude(status=const.RECIPE_STATUS_DELETED) + self.queryset = self.queryset.exclude(status=const.RECIPE_STATUS_DELETED) return super().list(request, *args, **kwargs) filterset_fields = {