mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Fix keyboards and nullable fields.
This commit is contained in:
parent
4bf5409295
commit
f4b9bf5339
3 changed files with 14 additions and 13 deletions
|
|
@ -39,7 +39,7 @@ class BaseField(metaclass=abc.ABCMeta):
|
|||
:param instance:
|
||||
:return:
|
||||
"""
|
||||
return instance.values.get(self.alias)
|
||||
return instance.values.get(self.alias, self.default)
|
||||
|
||||
def set_value(self, instance, value, parent=None):
|
||||
"""
|
||||
|
|
@ -96,7 +96,10 @@ class Field(BaseField):
|
|||
return value
|
||||
|
||||
def deserialize(self, value, parent=None):
|
||||
if self.base_object is not None and not hasattr(value, 'base_object') and not hasattr(value, 'to_python'):
|
||||
if isinstance(value, dict) \
|
||||
and self.base_object is not None \
|
||||
and not hasattr(value, 'base_object') \
|
||||
and not hasattr(value, 'to_python'):
|
||||
return self.base_object(conf={'parent': parent}, **value)
|
||||
return value
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue