mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-04 21:27:49 +02:00
Add a custom manager to filter private and unpublished stuff (#39)
* Implement a customer manager for flatpages * Implement public manager for private objects * Add support for unpublished objects in roster and consist * Add support for unpublished objects in bookshelf * Update filtering on REST views * Use uuid in urls.py * Increment version
This commit is contained in:
@@ -6,13 +6,16 @@ from bookshelf.serializers import BookSerializer
|
||||
|
||||
|
||||
class BookList(ListAPIView):
|
||||
queryset = Book.objects.all()
|
||||
serializer_class = BookSerializer
|
||||
|
||||
def get_queryset(self):
|
||||
return Book.objects.get_published(self.request.user)
|
||||
|
||||
|
||||
class BookGet(RetrieveAPIView):
|
||||
queryset = Book.objects.all()
|
||||
serializer_class = BookSerializer
|
||||
lookup_field = "uuid"
|
||||
|
||||
schema = AutoSchema(operation_id_base="retrieveBookByUUID")
|
||||
|
||||
def get_queryset(self):
|
||||
return Book.objects.get_published(self.request.user)
|
||||
|
Reference in New Issue
Block a user