Indeed, this is nothing that has to be in the Django core. You can do
something like this:
http://dpaste.com/hold/552209/
Although, I do not think that's the best solution. By catching all
DoesNotExist errors, the Django middleware will not receive the
exception anymore and exception logging fram
On 03/06/11 03:31, waylybaye wrote:
> Hi guys, how about add a hook to get_object_or_404 to render a
> template with the same name of model when object does not exist ?
>
> For example:
> user = get_object_or_404(User, pk=pk)
>
> if the user does not exist, get_object_or_404 will try to render "
Yes, I always use a try block to give some error messages or render an error
template.
I can do it with a simple helper method . I just think it may be useful for
others :)
2011/6/3 Justin Holmes
> For every convenience method, there are always ways to make it even more
> convenient.
>
> I thin
You can always create your own convenience method.
Atenciosamente,
Vinicius Mendes
Engenheiro de Computação
Globo.com
On Fri, Jun 3, 2011 at 12:30 AM, Justin Holmes wrote:
> For every convenience method, there are always ways to make it even more
> convenient.
>
> I think that if the needs are
For every convenience method, there are always ways to make it even more
convenient.
I think that if the needs are other than the very most typical use case (ie,
get_object_or_404) than a try block is indicated.
On Thu, Jun 2, 2011 at 10:31 PM, waylybaye wrote:
> Hi guys, how about add a hook t
Hi guys, how about add a hook to get_object_or_404 to render a
template with the same name of model when object does not exist ?
For example:
user = get_object_or_404(User, pk=pk)
if the user does not exist, get_object_or_404 will try to render "404/
user.html" to show the error page other than