Ejemplo n.º 1
0
 def get(request):
     br_list = BidRecord.objects.filter(
         profile__username=request.user).all()
     if not br_list:
         return error_request(ErrBaseNotData)
     return_data = array_success()
     return_data['data'] = serializer_list_data(br_list,
                                                IAmShootingSerializer,
                                                request)
     return success_request(return_data)
Ejemplo n.º 2
0
    def get(request):
        goods_list = Goods.objects.filter(is_new=True).all()

        if not goods_list:
            return error_request(ErrBaseNotData)

        return_data = array_success()
        return_data['data'] = serializer_list_data(goods_list,
                                                   RecommendSerializer,
                                                   request)
        return success_request(return_data)
Ejemplo n.º 3
0
    def get(request):
        goods_list = Goods.objects.all()

        if not goods_list:
            return error_request(ErrGoodsNotFound)

        return_data = array_success()
        return_data['data'] = serializer_list_data(goods_list,
                                                   GoodsDetailSerializer,
                                                   request)
        return success_request(return_data)
Ejemplo n.º 4
0
    def get(request):
        collection = Collection.objects.filter(
            user__username=request.user).all()

        if not collection:
            return error_request(ErrBaseNotData)

        return_data = array_success()
        data = serializer_list_data(collection, MyCollectionSerializer,
                                    request)
        print(data)
        return_data['data'] = None
        return success_request(return_data)
Ejemplo n.º 5
0
    def get(request):
        msg_array = []
        msg_list = MsgHandler.objects.filter(
            receiver__username=request.user.username).all()

        for msg in msg_list:
            msg_array.append(Msg.objects.filter(pk=msg.msg_id).first())

        if not msg_array:
            return error_request(ErrBaseNotData)

        return_data = array_success()
        return_data['data'] = (MsgListSerializer(value).data
                               for value in msg_array)
        return success_request(return_data)
Ejemplo n.º 6
0
    def get(request):
        try:
            category_id = request.query_params['category_id']
        except KeyError:
            return error_request(ErrBaseParams)

        goods_list = Goods.objects.filter(category_id=int(category_id))
        if not goods_list:
            return error_request(ErrBaseNotData)

        return_data = array_success()
        return_data['data'] = serializer_list_data(goods_list,
                                                   GoodsCategorySerializer,
                                                   request)
        return success_request(return_data)
Ejemplo n.º 7
0
 def get(request):
     collection_list = Collection.objects.filter(user__username=request.user).all()
     return_data = array_success()
     return_data['data'] = None
     return