Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails when using ModelPusherMixin with only get_queryset implemented #43

Open
mattjegan opened this issue Dec 18, 2019 · 0 comments
Open

Comments

@mattjegan
Copy link
Collaborator

When a viewset only has get_queryset implemented but fails to declare a queryset class property, DRF model pusher errors when trying to find the backend. I think it should try it's current way but if no queryset exists on the view, call get_queryset or even allow specific backends to be declared on the view.

  File "/Users/abc/Documents/xyz/Code/abc-api/.venv/lib/python3.6/site-packages/rest_framework/viewsets.py", line 83, in view
    self = cls(**initkwargs)
  File "/Users/abc/Documents/xyz/Code/abc-api/.venv/lib/python3.6/site-packages/drf_model_pusher/views.py", line 26, in __init__
    self.pusher_backends = self.get_models_pusher_backends()
  File "/Users/abc/Documents/xyz/Code/abc-api/.venv/lib/python3.6/site-packages/drf_model_pusher/views.py", line 30, in get_models_pusher_backends
    model = self.queryset.model
AttributeError: 'NoneType' object has no attribute 'model'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant