-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
All the examples directly set queryset for views. The documentation says that I should override the get_queryset() on them, but call super().get_queryset(), but this really does not work if we do not have the base class that would stop propagation of this call to the rest_framework's get_queryset(), which asserts the queryset is set.
I really liked the concept of this project trying to avoid all the mess with splitting queries and models, but only way how I was able to make this working was something like this:
class BaseVirtualModelListApiView(ListAPIView):
def get_queryset(self):
# make sure the ListApiView.get_queryset() is not called
return self.model.objects
class MyVirtualModelListApiView(v.GenericVirtualModelViewMixin, BaseVirtualModelListApiView):
pass
class BlogPostsView(MyVirtualModelListApiView):
model = Blog
Not sure if I am just stupid or there is some better way. In any case, it would be good do document how this should work.
Metadata
Metadata
Assignees
Labels
No labels