Same as Django's standard shortcut, but make sure to also raise 404 if the filter_kwargs don't match the required types.
(queryset, *filter_args, **filter_kwargs)
| 11 | |
| 12 | |
| 13 | def get_object_or_404(queryset, *filter_args, **filter_kwargs): |
| 14 | """ |
| 15 | Same as Django's standard shortcut, but make sure to also raise 404 |
| 16 | if the filter_kwargs don't match the required types. |
| 17 | """ |
| 18 | try: |
| 19 | return _get_object_or_404(queryset, *filter_args, **filter_kwargs) |
| 20 | except (TypeError, ValueError, ValidationError): |
| 21 | raise Http404 |
| 22 | |
| 23 | |
| 24 | class GenericAPIView(views.APIView): |
no outgoing calls