Some bugs (box-management didn't work); Tags now on search and in box content
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/labhelper) (push) Successful in 1m3s
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 12s

This commit is contained in:
2026-01-04 11:10:12 +01:00
parent 68bd013ac9
commit 232d2270c3
7 changed files with 40 additions and 10 deletions

View File

@@ -40,7 +40,7 @@ def index(request):
def box_detail(request, box_id):
"""Display contents of a box."""
box = get_object_or_404(Box, pk=box_id)
things = box.things.all()
things = box.things.prefetch_related('tags').all()
return render(request, 'boxes/box_detail.html', {
'box': box,
'things': things,
@@ -179,7 +179,7 @@ def search_api(request):
things = Thing.objects.filter(
Q(tags__facet__name__icontains=facet_name) &
Q(tags__name__icontains=tag_name)
).prefetch_related('files', 'links').select_related('box').distinct()[:50]
).prefetch_related('files', 'links', 'tags').select_related('box').distinct()[:50]
else:
# Normal search
things = Thing.objects.filter(
@@ -191,7 +191,7 @@ def search_api(request):
Q(links__url__icontains=query) |
Q(tags__name__icontains=query) |
Q(tags__facet__name__icontains=query)
).prefetch_related('files', 'links').select_related('box').distinct()[:50]
).prefetch_related('files', 'links', 'tags').select_related('box').distinct()[:50]
results = [
{
@@ -199,6 +199,13 @@ def search_api(request):
'name': thing.name,
'box': thing.box.id,
'description': thing.description[:100] if thing.description else '',
'tags': [
{
'name': tag.name,
'color': tag.facet.color,
}
for tag in thing.tags.all()
],
'files': [
{
'title': f.title,