浏览代码

增加用户日志

yf_yzl 2 年之前
父节点
当前提交
f71f958168
共有 1 个文件被更改,包括 7 次插入4 次删除
  1. 7 4
      smartfarming/views/user.py

+ 7 - 4
smartfarming/views/user.py

@@ -370,10 +370,13 @@ class HomeThemeModelAPIView(APIView):
         logo_url = request_data.get("logo_url")
         title_name = request_data.get("title_name")
         copyright = request_data.get("copyright")
-        theme = HomeThemeModel.objects.filter(id=1).update(
-            logo_url=logo_url,
-            title_name=title_name,
-            copyright=copyright
+        theme = HomeThemeModel.objects.update_or_create(
+            id = 1, defaults={
+            "logo_url": logo_url,
+            "title_name": title_name,
+            "copyright": copyright                
+            }
+
         )
         if theme:
             return Response({"code": 0, "msg": "success"})