try:
    obj = Model.objects.get(x = y)
except Model.DoesNotExist:
    ....

On Mon, Nov 15, 2010 at 6:23 AM, Akn <ak.alna...@gmail.com> wrote:
> Hi,
> I would like to use get_object to retrieve an object form the
> database, but if the object does not exist I do not want to display an
> error page(404). Is there any command that does that.
>
> ob=get_object(Table,x=y)
> if not ob
>    ....
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to