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
33 lines
767 B
Python
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
|
|
)
|