mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-02 05:26:45 +00:00
Handle dimension error in tablib
This commit is contained in:
parent
482a5dae4b
commit
322710d603
@ -95,6 +95,8 @@ class BomUploadManager:
|
|||||||
self.data = tablib.Dataset().load(raw_data)
|
self.data = tablib.Dataset().load(raw_data)
|
||||||
except tablib.UnsupportedFormat:
|
except tablib.UnsupportedFormat:
|
||||||
raise ValidationError({'bom_file': _('Error reading BOM file (invalid data)')})
|
raise ValidationError({'bom_file': _('Error reading BOM file (invalid data)')})
|
||||||
|
except tablib.core.InvalidDimensions:
|
||||||
|
raise ValidationError({'bom_file': _('Error reading BOM file (incorrect row size)')})
|
||||||
|
|
||||||
def guess_header(self, header, threshold=80):
|
def guess_header(self, header, threshold=80):
|
||||||
""" Try to match a header (from the file) to a list of known headers
|
""" Try to match a header (from the file) to a list of known headers
|
||||||
|
@ -782,7 +782,6 @@ class BomUpload(FormView):
|
|||||||
self.extractDataFromFile(manager)
|
self.extractDataFromFile(manager)
|
||||||
else:
|
else:
|
||||||
form = self.form
|
form = self.form
|
||||||
form.errors['bom_file'] = [_('no errors')]
|
|
||||||
|
|
||||||
return self.render_to_response(self.get_context_data(form=form))
|
return self.render_to_response(self.get_context_data(form=form))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user