Skip to content

Commit

Permalink
fixes record to serialize when it is a list #555
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi1693 committed Sep 3, 2023
1 parent 0981320 commit 47286f2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pynetbox/core/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,6 @@ def generic_list_parser(key_name, list_item):
and "object" in list_item
):
lookup = list_item["object_type"]
model = None
model = CONTENT_TYPE_MAPPER.get(lookup)
if model:
return model(list_item["object"], self.api, self.endpoint)
Expand Down Expand Up @@ -495,7 +494,7 @@ def serialize(self, nested=False, init=False):

if isinstance(current_val, list):
current_val = [
v.id if isinstance(v, Record) else v for v in current_val
v.serialize() if isinstance(v, Record) else v for v in current_val
]
if i in LIST_AS_SET and (
all([isinstance(v, str) for v in current_val])
Expand Down

0 comments on commit 47286f2

Please sign in to comment.