yf_ymm 5 роки тому
батько
коміт
c99e3fd017
1 змінених файлів з 15 додано та 12 видалено
  1. 15 12
      apps/Equipment/views.py

+ 15 - 12
apps/Equipment/views.py

@@ -1364,18 +1364,21 @@ class Sightsee_Pub(ListView):
         content = request.POST.get('content')
         # 简介
         desc = request.POST.get('desc')
-        Sightsee_Info.objects.create(
-            name=name,
-            price=price,
-            location=location,
-            sightsee_stime=sightsee_stime,
-            sightsee_etime=sightsee_etime,
-            sightsee_img=sightsee_img,
-            sightsee_tel=sightsee_tel,
-            addr=addr,
-            content=content,
-            desc=desc)
-        data = "0"
+        try:
+            Sightsee_Info.objects.create(
+                name=name,
+                price=price,
+                location=location,
+                sightsee_stime=sightsee_stime,
+                sightsee_etime=sightsee_etime,
+                sightsee_img=sightsee_img,
+                sightsee_tel=sightsee_tel,
+                addr=addr,
+                content=content,
+                desc=desc)
+            data = "1"
+        except:
+            data = "0"
         return HttpResponse(data)