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

Revert to bootstrap-treeview

- More "bootstrappy" design
- Already in code base
- Cleaner API
This commit is contained in:
Oliver
2021-12-11 00:08:17 +11:00
parent 3bc3ff493a
commit e9ae3eb01d
20 changed files with 116 additions and 11008 deletions

View File

@ -71,29 +71,16 @@ class CategorySerializer(InvenTreeModelSerializer):
class CategoryTree(InvenTreeModelSerializer):
""" Serializer for PartCategory """
id = serializers.IntegerField(source='pk', read_only=True)
text = serializers.CharField(source='name', read_only=True)
parent = serializers.SerializerMethodField()
def get_parent(self, obj):
return obj.parent.pk if obj.parent else '#'
a_attr = serializers.SerializerMethodField()
def get_a_attr(self, obj):
return {'href': obj.get_absolute_url()}
"""
Serializer for PartCategory tree
"""
class Meta:
model = PartCategory
fields = [
'id',
'text',
'pk',
'name',
'parent',
'a_attr',
]