I attempting to use easy-thumbnails in order to generate images from the ImageField. However the images are not showing up (pre-production).
I am wanting them to show up in the index.html view, using the image from the thing_detail.html view.
class Thing(models.Model):
...
def get_image_path(instance, filename):
return '/'.join(['article_images',instance.article.slug, filename])
class Upload(models.Model):
article = models.ForeignKey(Article, related_name="uploads")
image = models.ImageField(upload_to=get_image_path, blank=True)
index.html
{% extends 'layouts/base.html' %}
{% block title %}Home - {{ block.super }}{% endblock %}
{% load thumbnail %}
{% block content %}
...
<img src="{{ MEDIA_URL }}{{ upload.image|thumbnail_url:'thumbnail' }}" class="media" alt=""/>
...
{% endblock %}
thing_detail.html
...
{% for upload in uploads %}
<img src="{{ upload.image.url }}" alt="" />
{% endfor %}
...
...
THUMBNAIL_ALIASES = {
'': {
'thumbnail':{'size': (50, 50), 'crop': True},
},
}
...