Is it possible to do this from templates?

5 views
Skip to first unread message

PythonistL

unread,
Jun 27, 2006, 10:44:14 AM6/27/06
to Django users
Hi,
Is it possible to test ,if an image exists, from a template?
To explain:
Let's suppose in my template I use
<img src="/Media/Uploaded/Thumbnail/{{ImageName}}">

and {{ImageName}} is a picture that can exists but it needn't.
But if it does not exist, then I will receive an ugly picture in my
view (HTML)result.
So, I test that in my view but it would be better if I could test that
directly from my template
Thank you for help
L.

Jay Parlar

unread,
Jun 27, 2006, 10:53:31 AM6/27/06
to django...@googlegroups.com

You can always write a custom template filter that could check that
pretty easily.

Jay P.

Reply all
Reply to author
Forward
0 new messages