Explorar el Código

测报灯图片收集

yf_ymm hace 5 años
padre
commit
8e1f36fbd5
Se han modificado 1 ficheros con 6 adiciones y 4 borrados
  1. 6 4
      apps/Equipment/views.py

+ 6 - 4
apps/Equipment/views.py

@@ -269,9 +269,9 @@ class Equip_Show_List(ListView):
 class Equip_Show_Detail(ListView):
     def get(self,request):
         e_id = request.GET.get("id")
+        e_name = request.GET.get("name")
         if e_id:
             product = Product.objects.get(id=e_id)
-        e_name = request.GET.get("name")
         if e_name:
             product = Product.objects.get(title=e_name)
         return render(request, 'outerNet/exhibitionDetail.html', context={"product":product})
@@ -307,8 +307,9 @@ class Garden_View(ListView):
 class Garden_Intro(ListView):
     def get(self,request):
         pid = request.GET.get("id")
-        pick = Pick_Pub.objects.get(id=pid)
         pname = request.GET.get("name")
+        if pid:
+            pick = Pick_Pub.objects.get(id=pid)
         if pname:
             pick = Pick_Pub.objects.get(name=pname)
         return render(request, 'outerNet/pickIntro.html', context={"pick":pick})
@@ -381,11 +382,12 @@ class Dorm_List(ListView):
 class Dorm_Detail(ListView):
     def get(self,request):
         hotel_id = request.GET.get("id")
-        hotel = Hotel_Info.objects.get(id=hotel_id)
-        photos = Hotel_Photo.objects.filter(hotel=hotel)
         hotel_name = request.GET.get("name")
+        if hotel_id:
+            hotel = Hotel_Info.objects.get(id=hotel_id)
         if hotel_name:
             hotel = Hotel_Info.objects.get(name=hotel_name)
+        photos = Hotel_Photo.objects.filter(hotel=hotel)
         return render(request, 'outerNet/hotelDetail.html', context={"hotel":hotel,"photos":photos})
     def post(self,request):
         pass