mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Exclude metadata from StockLocation and StockItem model resource class
This commit is contained in:
parent
b6c2ade940
commit
aa3a86f372
@ -31,6 +31,7 @@ class LocationResource(ModelResource):
|
|||||||
exclude = [
|
exclude = [
|
||||||
# Exclude MPTT internal model fields
|
# Exclude MPTT internal model fields
|
||||||
'lft', 'rght', 'tree_id', 'level',
|
'lft', 'rght', 'tree_id', 'level',
|
||||||
|
'metadata',
|
||||||
]
|
]
|
||||||
|
|
||||||
def after_import(self, dataset, result, using_transactions, dry_run, **kwargs):
|
def after_import(self, dataset, result, using_transactions, dry_run, **kwargs):
|
||||||
@ -119,7 +120,7 @@ class StockItemResource(ModelResource):
|
|||||||
# Exclude MPTT internal model fields
|
# Exclude MPTT internal model fields
|
||||||
'lft', 'rght', 'tree_id', 'level',
|
'lft', 'rght', 'tree_id', 'level',
|
||||||
# Exclude internal fields
|
# Exclude internal fields
|
||||||
'serial_int',
|
'serial_int', 'metadata',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -344,6 +344,13 @@ class StockItemListTest(StockAPITestCase):
|
|||||||
for h in headers:
|
for h in headers:
|
||||||
self.assertIn(h, dataset.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
|
# Now, add a filter to the results
|
||||||
dataset = self.export_data({'location': 1})
|
dataset = self.export_data({'location': 1})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user