mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-05 05:37:50 +02:00
Add a CSV export functionality in admin and add price fields (#41)
* Implement an action do download data in csv * Refactor CSV download * Move price to main models and add csv to bookshelf * Update template and API * Small refactoring
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
from rest_framework.generics import ListAPIView, RetrieveAPIView
|
||||
from rest_framework.schemas.openapi import AutoSchema
|
||||
|
||||
from bookshelf.models import Book
|
||||
from bookshelf.serializers import BookSerializer
|
||||
from bookshelf.models import Book, Catalog
|
||||
from bookshelf.serializers import BookSerializer, CatalogSerializer
|
||||
|
||||
|
||||
class BookList(ListAPIView):
|
||||
@@ -19,3 +19,19 @@ class BookGet(RetrieveAPIView):
|
||||
|
||||
def get_queryset(self):
|
||||
return Book.objects.get_published(self.request.user)
|
||||
|
||||
|
||||
class CatalogList(ListAPIView):
|
||||
serializer_class = CatalogSerializer
|
||||
|
||||
def get_queryset(self):
|
||||
return Catalog.objects.get_published(self.request.user)
|
||||
|
||||
|
||||
class CatalogGet(RetrieveAPIView):
|
||||
serializer_class = CatalogSerializer
|
||||
lookup_field = "uuid"
|
||||
schema = AutoSchema(operation_id_base="retrieveCatalogByUUID")
|
||||
|
||||
def get_queryset(self):
|
||||
return Book.objects.get_published(self.request.user)
|
||||
|
Reference in New Issue
Block a user