+# -*- coding: utf-8 -*-
+# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+#
from django.shortcuts import get_object_or_404
from django.contrib.auth.decorators import login_required, user_passes_test
from piston.handler import BaseHandler
class BookHandler(BaseHandler):
model = Book
fields = ('slug', 'title')
-
+
@staff_required
def read(self, request, slug=None):
if slug:
return get_object_or_404(Book, slug=slug)
else:
return Book.objects.all()
-
+
@staff_required
def create(self, request):
form = BookImportForm(request.POST, request.FILES)