Add form to add multiple things to a box
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 32s
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 8s

This commit is contained in:
2025-12-28 22:50:37 +01:00
parent f30627196e
commit f6a953158d
7 changed files with 400 additions and 3 deletions

24
boxes/forms.py Normal file
View File

@@ -0,0 +1,24 @@
from django import forms
from .models import Thing
class ThingForm(forms.ModelForm):
"""Form for adding a Thing."""
class Meta:
model = Thing
fields = ('name', 'thing_type', 'description', 'picture')
widgets = {
'name': forms.TextInput(attrs={'class': 'form-control'}),
'thing_type': forms.Select(attrs={'class': 'form-control'}),
'description': forms.Textarea(attrs={'class': 'form-control', 'rows': 2}),
}
ThingFormSet = forms.modelformset_factory(
Thing,
form=ThingForm,
extra=1,
can_delete=False
)