X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/131ae407ca583a8a8086cf94c222c85fa3f5be63..b6d44713f806e7186589da45d7622123a9c36a60:/src/catalogue/api/views.py diff --git a/src/catalogue/api/views.py b/src/catalogue/api/views.py index abe8064c4..9c8f4f177 100644 --- a/src/catalogue/api/views.py +++ b/src/catalogue/api/views.py @@ -328,6 +328,42 @@ class TagCategoryView(LegacyListAPIView): return tags +class AuthorList(ListAPIView): + serializer_class = serializers.AuthorSerializer + queryset = Tag.objects.filter(category='author') + +class AuthorView(RetrieveAPIView): + serializer_class = serializers.AuthorSerializer + queryset = Tag.objects.filter(category='author') + lookup_field = 'slug' + +class EpochList(ListAPIView): + serializer_class = serializers.EpochSerializer + queryset = Tag.objects.filter(category='epoch') + +class EpochView(RetrieveAPIView): + serializer_class = serializers.EpochSerializer + queryset = Tag.objects.filter(category='epoch') + lookup_field = 'slug' + +class GenreList(ListAPIView): + serializer_class = serializers.GenreSerializer + queryset = Tag.objects.filter(category='genre') + +class GenreView(RetrieveAPIView): + serializer_class = serializers.GenreSerializer + queryset = Tag.objects.filter(category='genre') + lookup_field = 'slug' + +class KindList(ListAPIView): + serializer_class = serializers.KindSerializer + queryset = Tag.objects.filter(category='kind') + +class KindView(RetrieveAPIView): + serializer_class = serializers.KindSerializer + queryset = Tag.objects.filter(category='kind') + lookup_field = 'slug' + class TagView(RetrieveAPIView): permission_classes = [DjangoModelPermissionsOrAnonReadOnly]