Commit d3c84967 authored by Daniel W Bond's avatar Daniel W Bond

added initial api views to bookshare; will need to determine what other...

added initial api views to bookshare; will need to determine what other information, if any we wish to expose for the first go round
parent 3dafa110
from django.shortcuts import render
# standard library imports
from __future__ import absolute_import, print_function
# third party imports
from rest_framework.pagination import PageNumberPagination
from rest_framework.viewsets import ReadOnlyModelViewSet
# imports from your apps
from trades.models import Listing
from .serializers import ListingSerializer
# Create your views here.
# trades apis
class ListingPagination(PageNumberPagination):
page_size = 100 # number of results per page
page_size_query_param = 'page_size'
max_page_size = 1000 # so you can retrieve a maximum of 100,000 listings
class ListingViewSet(ReadOnlyModelViewSet):
queryset = Listing.objects.all().order_by('-created')
serializer_class = ListingSerializer
pagination_class = ListingPagination
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment