Box sorting field added and put into effect
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 1m41s
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 7s

This commit is contained in:
2026-01-19 23:56:26 +01:00
parent 2a825646a3
commit a1bc7967c5
5 changed files with 13 additions and 5 deletions

View File

@@ -27,7 +27,7 @@ spec:
mountPath: /data
containers:
- name: web
image: git.baumann.gr/adebaumann/labhelper:0.064
image: git.baumann.gr/adebaumann/labhelper:0.065
imagePullPolicy: Always
ports:
- containerPort: 8000

View File

@@ -1,3 +1,4 @@
from adminsortable2.admin import SortableAdminMixin
from django import forms
from django.contrib import admin
from django.contrib.admin import SimpleListFilter
@@ -13,7 +14,7 @@ class BoxFilter(SimpleListFilter):
parameter_name = 'box__pk'
def lookups(self, request, model_admin):
boxes = Box.objects.select_related('box_type').order_by('id')
boxes = Box.objects.select_related('box_type').order_by('sort_order')
return [(box.pk, str(box)) for box in boxes]
def queryset(self, request, queryset):
@@ -47,7 +48,7 @@ class BoxTypeAdmin(admin.ModelAdmin):
@admin.register(Box)
class BoxAdmin(admin.ModelAdmin):
class BoxAdmin(SortableAdminMixin, admin.ModelAdmin):
"""Admin configuration for Box model."""
list_display = ('id', 'box_type')

View File

@@ -41,9 +41,15 @@ class Box(models.Model):
on_delete=models.PROTECT,
related_name='boxes'
)
sort_order = models.PositiveIntegerField(
default=0,
db_index=True,
help_text='Order in which boxes are displayed'
)
class Meta:
verbose_name_plural = 'boxes'
ordering = ['sort_order']
def __str__(self):
return self.id

View File

@@ -79,7 +79,7 @@ def edit_thing(request, thing_id):
pk=thing_id
)
boxes = Box.objects.select_related('box_type').all().order_by('id')
boxes = Box.objects.select_related('box_type').all()
facets = Facet.objects.all().prefetch_related('tags')
picture_form = ThingPictureForm(instance=thing)
file_form = ThingFileForm()
@@ -192,7 +192,7 @@ def edit_thing(request, thing_id):
@login_required
def boxes_list(request):
"""Boxes list page showing all boxes with contents."""
boxes = Box.objects.select_related('box_type').prefetch_related('things').all().order_by('id')
boxes = Box.objects.select_related('box_type').prefetch_related('things').all()
return render(request, 'boxes/boxes_list.html', {
'boxes': boxes,
})

View File

@@ -39,6 +39,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'adminsortable2',
'mptt',
'django_mptt_admin',
'sorl.thumbnail',