django-export-action
django-export-action copied to clipboard
Export breaks on UUID fields
- Django Export Action version: 0.1.1
- Django version: 1.11.3
- Python version: 3.5.2
- Operating System: MacOS Sierra
Description
Export a models that uses UUIDField for primary key (and probably any other retular field).
My model:
class MyModel(models.Model):
id = models.UUIDField(
primary_key=True, max_length=37, unique=True,
default=uuid.uuid4, editable=False)
... # more stuff
What I Did
In the admin export, selected all field, including 'id'.
Error:
'ValueError' object has no attribute 'message'
on last line in /python3.5/site-packages/export_action/report.py in build_sheet:
try:
ws.append(row)
except ValueError as e:
ws.append([e.message])
Looking at a few frames above we see more relevant information:
In /python3.5/site-packages/openpyxl/worksheet/worksheet.py in append
else:
cell = Cell(self, row=row_idx, col_idx=col_idx, value=content)
Value of variable content:
UUID('0dfafd80-baaf-4d95-b357-4804bda3d751')
Deselecting id field in the export view removes the error (but of course, there are no IDs the export).