Files
labhelper/boxes/forms.py
Adrian A. Baumann 10cc24ff03
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 25s
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 6s
Add/remove/change image on box detail page added
2026-01-01 13:48:09 +01:00

33 lines
767 B
Python

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': 4}),
}
class ThingPictureForm(forms.ModelForm):
"""Form for uploading/changing a Thing picture."""
class Meta:
model = Thing
fields = ('picture',)
ThingFormSet = forms.modelformset_factory(
Thing,
form=ThingForm,
extra=1,
can_delete=False
)