You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
from rest_framework.views import APIView
|
|
|
|
from rest_framework.response import Response
|
|
|
|
|
|
|
|
from apps.goods.models import *
|
|
|
|
from apps.goods.serializers import *
|
|
|
|
|
|
|
|
class GoodsView(APIView):
|
|
|
|
def get(self, request, *args, **kwargs):
|
|
|
|
goods = Goods.objects.all()[:10]
|
|
|
|
goods_json = GoodsSerializers(goods, many=True)
|
|
|
|
print(goods_json)
|
|
|
|
print(goods_json.data)
|
|
|
|
return Response(goods_json.data)
|
|
|
|
|
|
|
|
|
|
|
|
class GoodsModelView(APIView):
|
|
|
|
def get(self, request, *args, **kwargs):
|
|
|
|
goods = Goods.objects.all()[:10]
|
|
|
|
goods_json = GoodsModelSerializer(goods, many=True)
|
|
|
|
print(goods_json)
|
|
|
|
print(goods_json.data)
|
|
|
|
return Response(goods_json.data)
|