﻿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
30587	Cloaking exceptions raised by get_object_or_404().	Ishwar Bhat	nobody	"When we use get_object_or_404() method to query an object, sometimes due to invalid inputs it will through exceptions. Instead can it raise 404 directly?
Ex:

Models:
{{{
>>class Test1(models.Model):
>>    c2 = models.CharField(max_length=10)

>>class Test2(models.Model):
>>    c1 = models.UUIDField(primary_key=True, default=uuid.uuid4)
>>    c2 = models.CharField(max_length=10)
}}}
query:
1. Below statement raises valueError:
{{{
    >> get_object_or_404(Test1, pk='test') 
    >> - invalid literal for int() with base 10: 'test'
}}}
2. Below statement raises ValidationError:
{{{
    >> get_object_or_404(Test2, pk=""test"")
    >> - 'test' is not a valid UUID.
}}}
So this method will throw different exceptions in different scenario. So would it be possible to raise 404 exceptions even if it finds invalid values."	New feature	closed	Database layer (models, ORM)	dev	Normal	duplicate			Unreviewed	0	0	0	0	0	0
