From ce248ccfbb81f1ec1d51484b5e291576cd40a808 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 1 May 2023 19:59:13 +0200 Subject: [PATCH] Added `children_ids` to the entity attributes serialized in `to_json`. --- platypush/entities/_base.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/platypush/entities/_base.py b/platypush/entities/_base.py index b5780c60a..bad21861a 100644 --- a/platypush/entities/_base.py +++ b/platypush/entities/_base.py @@ -196,11 +196,14 @@ if 'entity' not in Base.metadata: """ Returns the current entity as a flatten dictionary. """ - return dict( - self._column_to_pair(col) - for col in self.columns - if self._column_to_pair(col) - ) + return { + **dict( + self._column_to_pair(col) + for col in self.columns + if self._column_to_pair(col) + ), + 'children_ids': [c.id for c in self.children], + } def to_json(self) -> dict: """