Files
labhelper/boxes/views.py
Adrian A. Baumann ac11b6fa51
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
Add box detail page with thumbnails and view tests
2025-12-28 21:07:50 +01:00

21 lines
546 B
Python

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,
})