1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #4994: Add cable attribute to PowerFeed API serializer

This commit is contained in:
Jeremy Stretch
2020-08-13 10:30:28 -04:00
parent b405e8294b
commit ed0e212ce0
4 changed files with 6 additions and 3 deletions

View File

@ -12,6 +12,7 @@
* [#4946](https://github.com/netbox-community/netbox/issues/4946) - Extend ObjectPermission to OR multiple constraints
* [#4969](https://github.com/netbox-community/netbox/issues/4969) - Replace secret role user/group assignment with object permissions
* [#4982](https://github.com/netbox-community/netbox/issues/4982) - Extended ObjectVar to allow filtering API query
* [#4994](https://github.com/netbox-community/netbox/issues/4994) - Add `cable` attribute to PowerFeed API serializer
### Bug Fixes
@ -99,6 +100,7 @@ When running a report or custom script, its execution is now queued for backgrou
* dcim.FrontPortTemplate: Added `description` and `label` fields
* dcim.Interface: Added `label` field
* dcim.InterfaceTemplate: Added `description` and `label` fields
* dcim.PowerFeed: Added `cable` field
* dcim.PowerPanel: Added `tags` field
* dcim.PowerPort: Added ``label` field
* dcim.PowerPortTemplate: Added `description` and `label` fields

View File

@ -355,4 +355,4 @@ class NestedPowerFeedSerializer(WritableNestedSerializer):
class Meta:
model = models.PowerFeed
fields = ['id', 'url', 'name']
fields = ['id', 'url', 'name', 'cable']

View File

@ -782,10 +782,11 @@ class PowerFeedSerializer(TaggedObjectSerializer, CustomFieldModelSerializer):
choices=PowerFeedPhaseChoices,
default=PowerFeedPhaseChoices.PHASE_SINGLE
)
cable = NestedCableSerializer(read_only=True)
class Meta:
model = PowerFeed
fields = [
'id', 'url', 'power_panel', 'rack', 'name', 'status', 'type', 'supply', 'phase', 'voltage', 'amperage',
'max_utilization', 'comments', 'tags', 'custom_fields', 'created', 'last_updated',
'max_utilization', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'cable',
]

View File

@ -1959,7 +1959,7 @@ class PowerPanelTest(APIViewTestCases.APIViewTestCase):
class PowerFeedTest(APIViewTestCases.APIViewTestCase):
model = PowerFeed
brief_fields = ['id', 'name', 'url']
brief_fields = ['cable', 'id', 'name', 'url']
@classmethod
def setUpTestData(cls):