2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-08 12:50:55 +00:00

Initial work towards uploading a BOM file

- Create a form with a single FileField
This commit is contained in:
Oliver Walters
2019-05-24 23:56:36 +10:00
parent 2dc43f0cf1
commit 8b207d0d1d
4 changed files with 74 additions and 13 deletions

View File

@@ -38,24 +38,15 @@ class BomValidateForm(HelperForm):
]
class BomExportForm(HelperForm):
class BomImportForm(HelperForm):
""" Form for importing a BOM. Provides a file input box for upload """
# TODO - Define these choices somewhere else, and import them here
format_choices = (
('csv', 'CSV'),
('pdf', 'PDF'),
('xml', 'XML'),
('xlsx', 'XLSX'),
('html', 'HTML')
)
# Select export type
format = forms.CharField(label='Format', widget=forms.Select(choices=format_choices), required='true', help_text='Select export format')
bom_file = forms.FileField(label='BOM file', required=True, help_text="Select BOM file to upload")
class Meta:
model = Part
fields = [
'format',
'bom_file',
]