-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Prevent empty querysets to raise AssertionError.
#2862
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
Conversation
70d566a to
477a803
Compare
|
This >>> bool(queryset) is False
True
>>> assert queryset, 'no queryset define on the view'
AssertionError 'no queryset define on the view'Which is a lie. |
|
OK — this seems good to me. @tomchristie I'm feeling rusty: can you just cast your eye over it — but looks good yes? |
|
@xordoquy — Since you're about — can you look at this too? (Ta!) |
|
I will rebase it |
477a803 to
6f66798
Compare
|
done. |
rest_framework/permissions.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would change this lines to:
'Cannot apply DjangoModelPermissions on a view that '
'does not have `.queryset` property nor redefines `.get_queryset()`'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright
|
let me know if you prefer I squash the commits. |
|
It's ok for me. I'm just waiting the tests to be finished and I'll merge it. |
|
Excellent, thank you. |
|
👍 |
Prevent empty `queryset`s to raise AssertionError.
|
Thanks to you in the first place :) |
No description provided.