yf_yzl 2 лет назад
Родитель
Сommit
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"})