Skip to content

Commit 2ba47b9

Browse files
author
matmoncon
committed
fix: fix relationship properties always being included in serialization in V1
1 parent 7021e47 commit 2ba47b9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pyneo4j_ogm/core/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def dict( # type: ignore
273273
for field_name in getattr(self, "_relationship_properties"):
274274
field = cast(Union[RelationshipProperty, List], getattr(self, field_name))
275275

276-
if not isinstance(field, list):
276+
if not isinstance(field, list) and not (exclude is not None and field_name in exclude):
277277
base_dict[field_name] = [
278278
cast(Union[RelationshipModel, NodeModel], node).dict() for node in field.nodes
279279
]
@@ -327,7 +327,7 @@ def json( # type: ignore
327327
for field_name in getattr(self, "_relationship_properties"):
328328
field = cast(Union[RelationshipProperty, List], getattr(self, field_name))
329329

330-
if not isinstance(field, list):
330+
if not isinstance(field, list) and not (exclude is not None and field_name in exclude):
331331
modified_json[field_name] = [
332332
cast(Union[RelationshipModel, NodeModel], node).json() for node in field.nodes
333333
]

0 commit comments

Comments
 (0)