2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-15 09:21:26 +00:00

Ability to toggle part category "star" status via the API

This commit is contained in:
Oliver
2021-11-04 00:01:52 +11:00
parent 193d6b334c
commit 1c6eb41341
8 changed files with 88 additions and 26 deletions

View File

@ -35,8 +35,6 @@ class CategorySerializer(InvenTreeModelSerializer):
def __init__(self, *args, **kwargs):
self.starred_categories = kwargs.pop('starred_categories', [])
super().__init__(*args, **kwargs)
def get_starred(self, category):
@ -44,7 +42,7 @@ class CategorySerializer(InvenTreeModelSerializer):
Return True if the category is directly "starred" by the current user
"""
return category in self.starred_categories
return category in self.context.get('starred_categories', [])
url = serializers.CharField(source='get_absolute_url', read_only=True)