fields: ignore errors for shorter than expected rows in TableRowsField (#7905)
This is typical of the field gaining new columns after some forms were already saved.
This commit is contained in:
parent
596b6aaed4
commit
3d0fc529d7
|
@ -1484,7 +1484,13 @@ class TableRowsField(WidgetField):
|
|||
|
||||
for i, row_value in enumerate(value):
|
||||
for j, column in enumerate(self.columns):
|
||||
max_width = max(max_width, len(row_value[j]))
|
||||
try:
|
||||
max_width = max(max_width, len(row_value[j]))
|
||||
except IndexError:
|
||||
# ignore errors for shorter than expected rows, this is
|
||||
# typical of the field gaining new columns after some forms
|
||||
# were already saved.
|
||||
pass
|
||||
|
||||
r.append(' '.join(['='*max_width]*(len(self.columns))))
|
||||
r.append(' '.join([column.center(max_width) for column in self.columns]))
|
||||
|
|
Loading…
Reference in New Issue