2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-13 10:35:40 +00:00

Add instance-specific filters to API OPTIONS data

This commit is contained in:
Oliver
2021-07-21 20:59:55 +10:00
parent 5f8c9a0f31
commit dad9239a1c
3 changed files with 62 additions and 0 deletions

View File

@ -359,6 +359,18 @@ class Part(MPTTModel):
return reverse('api-part-list')
def api_instance_filters(self):
"""
Return API query filters for limiting field results against this instance
"""
return {
'variant_of': {
'exclude_tree': self.pk,
}
}
def get_context_data(self, request, **kwargs):
"""
Return some useful context data about this part for template rendering