Skip to content

Commit 47286f2

Browse files
committed
fixes record to serialize when it is a list #555
1 parent 0981320 commit 47286f2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pynetbox/core/response.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ def generic_list_parser(key_name, list_item):
373373
and "object" in list_item
374374
):
375375
lookup = list_item["object_type"]
376-
model = None
377376
model = CONTENT_TYPE_MAPPER.get(lookup)
378377
if model:
379378
return model(list_item["object"], self.api, self.endpoint)
@@ -495,7 +494,7 @@ def serialize(self, nested=False, init=False):
495494

496495
if isinstance(current_val, list):
497496
current_val = [
498-
v.id if isinstance(v, Record) else v for v in current_val
497+
v.serialize() if isinstance(v, Record) else v for v in current_val
499498
]
500499
if i in LIST_AS_SET and (
501500
all([isinstance(v, str) for v in current_val])

0 commit comments

Comments
 (0)