﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
22303	Have get_object_or_404 check catch ValueError	eddie@…	nobody	"A pretty simple change, but one that I would find very helpful in production use. Basically, get_object_or_404 catches queryset.model.DoesNotExist and turns that into Http404, and I think it would be helpful if it also caught ValueError to handle the case where the passed in parameter is not valid for the field (like if it's a string and the field type is Integer, for example).

{{{#!python
from django.shortcuts import get_object_or_404
from django.db.models.base import ModelBase
from django.contrib.contenttypes.models import ContentType

def test_get_object_or_404():
    # print ""<ContentType: content type>""
    print get_object_or_404(ContentType, id='1')

    # raise Http404: No ContentType matches the given query.
    print get_object_or_404(ContentType, id='123456789')

    # raise ValueError: invalid literal for int() with base 10: '123a'
    print get_object_or_404(ContentType(), id='123a')
}}}"	New feature	closed	Uncategorized	1.6	Normal	wontfix			Unreviewed	0	0	0	0	0	0
