def get(self,request,*args,**kwargs):
     try:
         get=CategoryCarousel.objects.all()
         serializer=GetCategoryCarouselSerializers(get,many=True)
         return JsonResponse({"success":True,"data":serializer.data})
     except CategoryCarousel.DoesNotExist:
         raise Http404
예제 #2
0
 def get(self,request,*args,**kwargs):
     try:
         get=CategoryCarousel.objects.all().filter(status=True)
         serializer=GetCategoryCarouselSerializers(get,many=True)
         return JsonResponse({"success":True,"data":serializer.data})
     except:
         return JsonResponse({"success":False,"meaasge": "categorycarousel with active status nor found"})
 def get(self, request, id, format=None):
     try:
         cat = self.get_object(id)
         serializer = GetCategoryCarouselSerializers(cat)
         return JsonResponse({"success": True, "data": serializer.data})
     except Http404:
         return JsonResponse({
             "success": False,
             "message:": "CategoryCarousel not found"
         })
예제 #4
0
 def get(self, request, id, format=None):
     try:
         cat = self.get_object(id)
         serializer = GetCategoryCarouselSerializers(cat, many=True)
         if serializer:
             return JsonResponse({"success": True, "data": serializer.data})
         return JsonResponse({
             "success": True,
             "data": None,
             "message": "no data found with this id "
         })
     except:
         return JsonResponse({"message:": "category_carousel  not found"})