Login added, tests completed
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 16s
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 3s
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 16s
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 3s
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.http import HttpResponse, JsonResponse
|
||||
from django.shortcuts import get_object_or_404, redirect, render
|
||||
|
||||
@@ -5,6 +6,7 @@ from .forms import ThingFormSet
|
||||
from .models import Box, Thing, ThingType
|
||||
|
||||
|
||||
@login_required
|
||||
def index(request):
|
||||
"""Home page with boxes and thing types."""
|
||||
boxes = Box.objects.select_related('box_type').all().order_by('id')
|
||||
@@ -15,6 +17,7 @@ def index(request):
|
||||
})
|
||||
|
||||
|
||||
@login_required
|
||||
def box_detail(request, box_id):
|
||||
"""Display contents of a box."""
|
||||
box = get_object_or_404(Box, pk=box_id)
|
||||
@@ -25,6 +28,7 @@ def box_detail(request, box_id):
|
||||
})
|
||||
|
||||
|
||||
@login_required
|
||||
def thing_detail(request, thing_id):
|
||||
"""Display details of a thing."""
|
||||
thing = get_object_or_404(
|
||||
@@ -48,11 +52,13 @@ def thing_detail(request, thing_id):
|
||||
})
|
||||
|
||||
|
||||
@login_required
|
||||
def search(request):
|
||||
"""Search page for things."""
|
||||
return render(request, 'boxes/search.html')
|
||||
|
||||
|
||||
@login_required
|
||||
def search_api(request):
|
||||
"""AJAX endpoint for searching things."""
|
||||
query = request.GET.get('q', '').strip()
|
||||
@@ -76,6 +82,7 @@ def search_api(request):
|
||||
return JsonResponse({'results': results})
|
||||
|
||||
|
||||
@login_required
|
||||
def add_things(request, box_id):
|
||||
"""Add multiple things to a box at once."""
|
||||
box = get_object_or_404(Box, pk=box_id)
|
||||
@@ -106,6 +113,7 @@ def add_things(request, box_id):
|
||||
})
|
||||
|
||||
|
||||
@login_required
|
||||
def thing_type_detail(request, type_id):
|
||||
"""Display details of a thing type with its hierarchy and things."""
|
||||
thing_type = get_object_or_404(ThingType, pk=type_id)
|
||||
|
||||
Reference in New Issue
Block a user