summaryrefslogtreecommitdiff
path: root/squad_client/core/models.py
diff options
context:
space:
mode:
authorAmro Hassaan <amro.hassaan@linaro.org>2020-06-09 20:55:05 -0400
committerAmro Hassaan <amro.hassaan@linaro.org>2020-06-24 09:49:16 -0400
commitc3fefbd1b3be721562be420d529d141482d78473 (patch)
tree5f103f0c486abec0e3116c3ab93dd62e98b578be /squad_client/core/models.py
parent6c9ad26ce95111214259c7279270bcffe547666c (diff)
core: models: add nested endpoints to models
Diffstat (limited to 'squad_client/core/models.py')
-rw-r--r--squad_client/core/models.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/squad_client/core/models.py b/squad_client/core/models.py
index 3ffd037..6bf0479 100644
--- a/squad_client/core/models.py
+++ b/squad_client/core/models.py
@@ -51,6 +51,10 @@ class SquadObject:
if obj is None:
obj = self
+ nested_endpoints = [x[1] for x in SquadApi.schema_nested_eps if x[0].lower() == obj.__class__.__name__.lower()]
+ if nested_endpoints:
+ setattr(obj, 'nested_endpoints', nested_endpoints)
+
attrs = obj.attrs if len(obj.attrs) else [attr for attr in result.keys()]
for attr in attrs:
setattr(obj, attr.replace(' ', '_').replace('/', '_').replace('-', '_'), result[attr])