I have an icon image in all apps:
/app_name/static/model_name/images/icon.png
which is adding to model list in admin interface. And I want to crop it using easy-thumbnails and custom template tags:
template.html:
{% load project_tags %}
<th scope="row">{% load_icon model %}<a href="{{ model.admin_url }}">{{ model.name }}</a></th>
project_tags.py
from easy_thumbnails.files import get_thumbnailer
class LoadIcon(template.Node):
def __init__(self, model_obj):
self.model_obj = Variable(model_obj)
def render(self, context):
return '<img src="%s" />' % get_thumbnailer('/static/'+model_name+'/images/icon.png')['model_icon'].url
settings.py
THUMBNAIL_ALIASES = {
'': {
'model_icon': {'size': (20, 20), 'crop': True},
},
}
But I have an "SuspiciousOperation" error: SuspiciousOperation at /admin/ Attempted access to '/polls/images/icon.png' denied.
Did I do something wrong ?