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