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
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:
24
boxes/forms.py
Normal file
24
boxes/forms.py
Normal 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
|
||||
)
|
||||
Reference in New Issue
Block a user