Added arbitrary files and links to boxes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from django import forms
|
||||
|
||||
from .models import Box, BoxType, Thing
|
||||
from .models import Box, BoxType, Thing, ThingFile, ThingLink
|
||||
|
||||
|
||||
class ThingForm(forms.ModelForm):
|
||||
@@ -24,6 +24,30 @@ class ThingPictureForm(forms.ModelForm):
|
||||
fields = ('picture',)
|
||||
|
||||
|
||||
class ThingFileForm(forms.ModelForm):
|
||||
"""Form for adding a file to a Thing."""
|
||||
|
||||
class Meta:
|
||||
model = ThingFile
|
||||
fields = ('title', 'file')
|
||||
widgets = {
|
||||
'title': forms.TextInput(attrs={'style': 'width: 100%; padding: 10px 15px; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 14px;'}),
|
||||
'file': forms.FileInput(attrs={'style': 'width: 100%;'}),
|
||||
}
|
||||
|
||||
|
||||
class ThingLinkForm(forms.ModelForm):
|
||||
"""Form for adding a link to a Thing."""
|
||||
|
||||
class Meta:
|
||||
model = ThingLink
|
||||
fields = ('title', 'url')
|
||||
widgets = {
|
||||
'title': forms.TextInput(attrs={'style': 'width: 100%; padding: 10px 15px; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 14px;'}),
|
||||
'url': forms.URLInput(attrs={'style': 'width: 100%; padding: 10px 15px; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 14px;'}),
|
||||
}
|
||||
|
||||
|
||||
class BoxTypeForm(forms.ModelForm):
|
||||
"""Form for adding/editing a BoxType."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user