mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-13 02:19:54 +00:00
Set parent object
This commit is contained in:
parent
1c81842167
commit
e2dca9da0d
2 changed files with 14 additions and 1 deletions
|
|
@ -55,6 +55,18 @@ class Deserializable:
|
|||
if hasattr(attr, 'de_json'):
|
||||
attr.bot = bot
|
||||
|
||||
@property
|
||||
def parent(self):
|
||||
return getattr(self, '_parent', None)
|
||||
|
||||
@parent.setter
|
||||
def parent(self, value):
|
||||
setattr(self, '_parent', value)
|
||||
for name, attr in self.__dict__.items():
|
||||
if hasattr(attr, 'de_json'):
|
||||
attr.parent = self
|
||||
|
||||
|
||||
@classmethod
|
||||
def de_json(cls, raw_data):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue