2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 03:00:54 +00:00

Parameter ordering fix (#3704)

* Hard-code URL fforr loadPartParameterTable function

* Improve API efficiency for including parameter data in Part query

* Fix loading of part parameter data into table
This commit is contained in:
Oliver
2022-09-21 23:31:24 +10:00
committed by GitHub
parent 33326f6eaf
commit 829a9d8311
4 changed files with 32 additions and 7 deletions

View File

@ -247,6 +247,19 @@ class PartParameterTemplateSerializer(InvenTreeModelSerializer):
class PartParameterSerializer(InvenTreeModelSerializer):
"""JSON serializers for the PartParameter model."""
def __init__(self, *args, **kwargs):
"""Custom initialization method for the serializer.
Allows us to optionally include or exclude particular information
"""
template_detail = kwargs.pop('template_detail', False)
super().__init__(*args, **kwargs)
if not template_detail:
self.fields.pop('template_detail')
template_detail = PartParameterTemplateSerializer(source='template', many=False, read_only=True)
class Meta: