mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 12:06:44 +00:00
Only include extra context information if requested
This commit is contained in:
parent
c7980a347e
commit
e920fc31e7
@ -9,6 +9,8 @@ from rest_framework.metadata import SimpleMetadata
|
|||||||
from rest_framework.utils import model_meta
|
from rest_framework.utils import model_meta
|
||||||
from rest_framework.fields import empty
|
from rest_framework.fields import empty
|
||||||
|
|
||||||
|
from InvenTree.helpers import str2bool
|
||||||
|
|
||||||
import users.models
|
import users.models
|
||||||
|
|
||||||
|
|
||||||
@ -49,6 +51,8 @@ class InvenTreeMetadata(SimpleMetadata):
|
|||||||
|
|
||||||
context = {}
|
context = {}
|
||||||
|
|
||||||
|
if str2bool(request.query_params.get('context', False)):
|
||||||
|
|
||||||
if hasattr(self.serializer, 'get_context_data'):
|
if hasattr(self.serializer, 'get_context_data'):
|
||||||
context = self.serializer.get_context_data()
|
context = self.serializer.get_context_data()
|
||||||
elif hasattr(self.erializer, 'CONTEXT_DATA'):
|
elif hasattr(self.erializer, 'CONTEXT_DATA'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user