mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 20:46:47 +00:00
- Add "get_fields()" method to InvenTreeResource - Override default behaviour and exclude some common fields - Will flow down to any inheriting classes (cherry picked from commit 941451203a3d9a9ef2c522aba19cdbaaa140e05a) Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
parent
46da332afe
commit
afa7ed873f
@ -31,3 +31,15 @@ class InvenTreeResource(ModelResource):
|
|||||||
row[idx] = val
|
row[idx] = val
|
||||||
|
|
||||||
return row
|
return row
|
||||||
|
|
||||||
|
def get_fields(self, **kwargs):
|
||||||
|
"""Return fields, with some common exclusions"""
|
||||||
|
|
||||||
|
fields = super().get_fields(**kwargs)
|
||||||
|
|
||||||
|
fields_to_exclude = [
|
||||||
|
'metadata',
|
||||||
|
'lft', 'rght', 'tree_id', 'level',
|
||||||
|
]
|
||||||
|
|
||||||
|
return [f for f in fields if f.column_name not in fields_to_exclude]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user