mirror of
https://github.com/inventree/InvenTree.git
synced 2025-12-17 17:58:22 +00:00
[API] Query improvements (#11034)
* Improve prefetch fields for API * Cache ContentType queryset for getModelsWithMixin - Called a LOT of times for an options request - Store the list in the session cache - Much faster than redis - and expires after the session is complete * Skip optional prefetch for options requests * Custom implementation of DjangoModelPermission - Cache the queryset against the view - Prevents multiple hits for OPTIONS request - Saves > 100ms on /stock/ options request
This commit is contained in:
@@ -268,7 +268,11 @@ class ManufacturerPartSerializer(
|
||||
source='part', many=False, read_only=True, allow_null=True
|
||||
),
|
||||
True,
|
||||
prefetch_fields=['part'],
|
||||
prefetch_fields=[
|
||||
Prefetch(
|
||||
'part', queryset=part.models.Part.objects.select_related('pricing_data')
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
pretty_name = enable_filter(
|
||||
|
||||
Reference in New Issue
Block a user