django-fastdev
django-fastdev copied to clipboard
`User.objects.get(4)` should give a good error message
The current error in django is:
TypeError: cannot unpack non-iterable int object
If you do User.objects.get('123')
you get:
ValueError: too many values to unpack (expected 2)
What error message should be shown?
Maybe something like:
"Got 4, but get/filter takes keyword arguments or Q objects. Maybe you meant pk=4?"
I think the check that should be made is that none of the *args should be non-Q-objects.