1439907233e221cfff3f1f0f8eaef27dc26e49f0
[wolnelektury.git] / src / catalogue / api / views.py
1 from rest_framework.generics import ListAPIView, RetrieveAPIView
2 from . import serializers
3 from catalogue.models import Book, Collection
4
5
6 class CollectionList(ListAPIView):
7     queryset = Collection.objects.all()
8     serializer_class = serializers.CollectionListSerializer
9
10
11 class CollectionDetail(RetrieveAPIView):
12     queryset = Collection.objects.all()
13     lookup_field = 'slug'
14     serializer_class = serializers.CollectionSerializer
15
16
17 class BookDetail(RetrieveAPIView):
18     queryset = Book.objects.all()
19     lookup_field = 'slug'
20     serializer_class = serializers.BookDetailSerializer