Exclude metadata from StockLocation and StockItem model resource class

This commit is contained in:
Oliver Walters 2022-05-18 21:33:40 +10:00
parent b6c2ade940
commit aa3a86f372
2 changed files with 9 additions and 1 deletions

View File

@ -31,6 +31,7 @@ class LocationResource(ModelResource):
exclude = [
# Exclude MPTT internal model fields
'lft', 'rght', 'tree_id', 'level',
'metadata',
]
def after_import(self, dataset, result, using_transactions, dry_run, **kwargs):
@ -119,7 +120,7 @@ class StockItemResource(ModelResource):
# Exclude MPTT internal model fields
'lft', 'rght', 'tree_id', 'level',
# Exclude internal fields
'serial_int',
'serial_int', 'metadata',
]

View File

@ -344,6 +344,13 @@ class StockItemListTest(StockAPITestCase):
for h in headers:
self.assertIn(h, dataset.headers)
excluded_headers = [
'metadata',
]
for h in excluded_headers:
self.assertNotIn(h, dataset.headers)
# Now, add a filter to the results
dataset = self.export_data({'location': 1})