Add box detail page with thumbnails and view tests
Some checks failed
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/labhelper) (push) Successful in 2m26s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/labhelper-data-loader) (push) Successful in 23s
SonarQube Scan / SonarQube Trigger (push) Failing after 19s

This commit is contained in:
2025-12-28 21:07:50 +01:00
parent 23ede15938
commit ac11b6fa51
8 changed files with 289 additions and 4 deletions

View File

@@ -1,7 +1,20 @@
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, render
from .models import Box
def index(request):
"""Simple index page."""
html = '<h1>LabHelper</h1><p><a href="/admin/">Admin</a></p>'
return HttpResponse(html)
def box_detail(request, box_id):
"""Display contents of a box."""
box = get_object_or_404(Box, pk=box_id)
things = box.things.select_related('thing_type').all()
return render(request, 'boxes/box_detail.html', {
'box': box,
'things': things,
})