Include "parts" count in Category API

This commit is contained in:
Oliver Walters 2020-04-03 09:15:09 +11:00
parent 40822a93df
commit 7e8664a4dd

View File

@ -18,6 +18,8 @@ class CategorySerializer(InvenTreeModelSerializer):
url = serializers.CharField(source='get_absolute_url', read_only=True) url = serializers.CharField(source='get_absolute_url', read_only=True)
parts = serializers.IntegerField(source='item_count', read_only=True)
class Meta: class Meta:
model = PartCategory model = PartCategory
fields = [ fields = [
@ -27,6 +29,7 @@ class CategorySerializer(InvenTreeModelSerializer):
'pathstring', 'pathstring',
'url', 'url',
'parent', 'parent',
'parts',
] ]