2 Commits

Author SHA1 Message Date
bcba59b5e4 fixed Unbound error 2025-12-28 23:22:13 +01:00
ed44deb5a6 Updated boxes page with links and smaller thumbnails 2025-12-28 23:19:51 +01:00
2 changed files with 9 additions and 6 deletions

View File

@@ -43,20 +43,21 @@
background-color: #f8f9fa;
}
.thumbnail {
width: 200px;
height: 200px;
width: 50px;
height: 50px;
object-fit: cover;
border-radius: 4px;
}
.no-image {
width: 200px;
height: 200px;
width: 50px;
height: 50px;
background-color: #e0e0e0;
display: flex;
align-items: center;
justify-content: center;
color: #999;
border-radius: 4px;
font-size: 12px;
}
.back-link {
margin-bottom: 20px;
@@ -98,14 +99,14 @@
<tr>
<td>
{% if thing.picture %}
{% thumbnail thing.picture "200x200" crop="center" as thumb %}
{% thumbnail thing.picture "50x50" crop="center" as thumb %}
<img src="{{ thumb.url }}" alt="{{ thing.name }}" class="thumbnail">
{% endthumbnail %}
{% else %}
<div class="no-image">No image</div>
{% endif %}
</td>
<td>{{ thing.name }}</td>
<td><a href="{% url 'thing_detail' thing.id %}">{{ thing.name }}</a></td>
<td>{{ thing.thing_type.name }}</td>
<td>{{ thing.description|default:"-" }}</td>
</tr>

View File

@@ -78,6 +78,8 @@ def add_things(request, box_id):
if created_count > 0:
success_message = f'Added {created_count} thing{"s" if created_count > 1 else ""} successfully.'
formset = ThingFormSet()
else:
formset = ThingFormSet()
return render(request, 'boxes/add_things.html', {
'box': box,