Skip to content

Commit

Permalink
Include description fields in brief mode serializrs
Browse files Browse the repository at this point in the history
following netbox example
  • Loading branch information
matejv committed May 7, 2024
1 parent 6f2060c commit 18ed7b1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions netbox_inventory/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Meta:
'tags', 'custom_fields', 'created', 'last_updated', 'asset_count',
'purchase_count', 'delivery_count',
)
brief_fields = ('id', 'url', 'display', 'name', 'slug')
brief_fields = ('id', 'url', 'display', 'name', 'slug', 'description')


class PurchaseSerializer(NetBoxModelSerializer):
Expand All @@ -44,7 +44,7 @@ class Meta:
'comments', 'tags', 'custom_fields', 'created', 'last_updated',
'asset_count', 'delivery_count',
)
brief_fields = ('id', 'url', 'display', 'supplier', 'name', 'status', 'date')
brief_fields = ('id', 'url', 'display', 'supplier', 'name', 'status', 'date', 'description')


class DeliverySerializer(NetBoxModelSerializer):
Expand All @@ -61,7 +61,7 @@ class Meta:
'id', 'url', 'display', 'purchase', 'name', 'date', 'description', 'comments',
'receiving_contact', 'tags', 'custom_fields', 'created', 'last_updated', 'asset_count',
)
brief_fields = ('id', 'url', 'display', 'name', 'date')
brief_fields = ('id', 'url', 'display', 'name', 'date', 'description')


class InventoryItemGroupSerializer(NestedGroupModelSerializer):
Expand Down Expand Up @@ -135,7 +135,7 @@ class Meta:
'warranty_start', 'warranty_end',
'comments', 'tags', 'custom_fields', 'created', 'last_updated'
)
brief_fields = ('id', 'url', 'display', 'serial')
brief_fields = ('id', 'url', 'display', 'serial', 'name')
# DRF autiomatically creates validator from model's unique_together contraints
# that doesn't work if we allow some filelds in a unique_together to be null
# so we remove DRF's auto generated validators and rely on model's validation
Expand Down

0 comments on commit 18ed7b1

Please sign in to comment.