Skip to content

Commit

Permalink
Thumbnails
Browse files Browse the repository at this point in the history
  • Loading branch information
norm committed Aug 8, 2021
1 parent 735003e commit 97eb64d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions hasworn/settings.py
Expand Up @@ -43,6 +43,7 @@
'django.contrib.messages',
'django.contrib.staticfiles',
'storages',
'sorl.thumbnail',

'hasworn.wearers',
'hasworn.clothing',
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Expand Up @@ -4,3 +4,4 @@ psycopg2-binary==2.9.1
django-storages==1.11.1
boto3==1.18.16
Pillow==8.3.1
sorl-thumbnail==12.7.0
6 changes: 6 additions & 0 deletions templates/wearers/wearer_page.html
@@ -1,9 +1,15 @@
{% extends "wearers/base.html" %}
{% load thumbnail %}

{% block content %}
<h2>most recently worn</h2>
{% for wearing in wearer.wearings.all|slice:':10' %}
<li>
{% if wearing.clothing.image %}
{% thumbnail wearing.clothing.image "60x60" crop="center" as thumb %}
<img src='{{thumb.url}}' alt=''>
{% endthumbnail %}
{% endif %}
<a href='{{wearing.clothing.static_site_url}}'>{{wearing.clothing}}</a>
on {{wearing.day}}
</li>
Expand Down

0 comments on commit 97eb64d

Please sign in to comment.