1 # This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
5 from django.http import Http404
6 from rest_framework.permissions import DjangoModelPermissions
7 from rest_framework.response import Response
8 from rest_framework import status
9 from rest_framework.views import APIView
10 from picture.forms import PictureImportForm
11 from picture.models import Picture
14 class PicturesView(APIView):
15 permission_classes = [DjangoModelPermissions]
16 queryset = Picture.objects.none() # Required for DjangoModelPermissions
18 def post(self, request):
19 data = json.loads(request.POST.get('data'))
20 form = PictureImportForm(data)
23 return Response({}, status=status.HTTP_201_CREATED)