django-imagekit
django-imagekit copied to clipboard
Option to suppress exceptions with templatetags
I have code like this in the template:
{% thumbnail '588x344' idea.image as thumb %}
<img src="{{ thumb.url }}" alt="{{ idea.title }}" image-ratio />
This will cause a 500 error if the source image is missing. This commonly happens during development when the database and media dir get out of sync.
IMHO there should be a way for this to easily return a 404, converting it from an error which completely breaks the page into a more appropriate 'broken image' icon from the browser.
hmm, well it's hard to do that without swallowing all the debugging info
being able to specify a default fallback image for missing src would be handy though
this was the simplest fix I could find - a flag on the exception class that allow Django template engine to suppress the exception
it means {{ thumb.url }} goes through as empty string, but at least I can render my page and see which image was even missing