Skip to content

Commit

Permalink
Added installed_module on NestedModuleBaySerializer (#15245)
Browse files Browse the repository at this point in the history
* added installed_module on NestedModuleBaySerializer #15243

* Update test

---------

Co-authored-by: Jeremy Stretch <[email protected]>
  • Loading branch information
abhi1693 and jeremystretch authored Feb 23, 2024
1 parent 17ec264 commit edb7d24
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions netbox/dcim/api/nested_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,11 @@ class Meta:

class NestedModuleBaySerializer(WritableNestedSerializer):
url = serializers.HyperlinkedIdentityField(view_name='dcim-api:modulebay-detail')
module = NestedModuleSerializer(required=False, read_only=True, allow_null=True)
installed_module = ModuleBayNestedModuleSerializer(required=False, allow_null=True)

class Meta:
model = models.ModuleBay
fields = ['id', 'url', 'display', 'module', 'name']
fields = ['id', 'url', 'display', 'installed_module', 'name']


class NestedDeviceBaySerializer(WritableNestedSerializer):
Expand Down
3 changes: 1 addition & 2 deletions netbox/dcim/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1039,8 +1039,7 @@ class Meta:
model = ModuleBay
fields = [
'id', 'url', 'display', 'device', 'name', 'installed_module', 'label', 'position', 'description', 'tags',
'custom_fields',
'created', 'last_updated',
'custom_fields', 'created', 'last_updated',
]


Expand Down
2 changes: 1 addition & 1 deletion netbox/dcim/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1755,7 +1755,7 @@ def setUpTestData(cls):

class ModuleBayTest(APIViewTestCases.APIViewTestCase):
model = ModuleBay
brief_fields = ['display', 'id', 'module', 'name', 'url']
brief_fields = ['display', 'id', 'installed_module', 'name', 'url']
bulk_update_data = {
'description': 'New description',
}
Expand Down

0 comments on commit edb7d24

Please sign in to comment.