From 7e8664a4dd035703e94cf558f504c5fc2c3becda Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Fri, 3 Apr 2020 09:15:09 +1100 Subject: [PATCH] Include "parts" count in Category API --- InvenTree/part/serializers.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/InvenTree/part/serializers.py b/InvenTree/part/serializers.py index c23298a441..1c7ae6f4ca 100644 --- a/InvenTree/part/serializers.py +++ b/InvenTree/part/serializers.py @@ -18,6 +18,8 @@ class CategorySerializer(InvenTreeModelSerializer): url = serializers.CharField(source='get_absolute_url', read_only=True) + parts = serializers.IntegerField(source='item_count', read_only=True) + class Meta: model = PartCategory fields = [ @@ -27,6 +29,7 @@ class CategorySerializer(InvenTreeModelSerializer): 'pathstring', 'url', 'parent', + 'parts', ]