from_dict() implemented
This commit is contained in:
parent
13ca097909
commit
b0f76f4c49
@ -71,6 +71,15 @@ class PyroUser:
|
|||||||
|
|
||||||
return cls(**db_entry)
|
return cls(**db_entry)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
async def from_dict(cls, **kwargs):
|
||||||
|
if "location" in kwargs:
|
||||||
|
try:
|
||||||
|
kwargs["location"] = await Location.get(kwargs["location"]) # type: ignore
|
||||||
|
except ValueError:
|
||||||
|
kwargs["location"] = None # type: ignore
|
||||||
|
return cls(**kwargs)
|
||||||
|
|
||||||
async def update_locale(self, locale: Union[str, None]) -> None:
|
async def update_locale(self, locale: Union[str, None]) -> None:
|
||||||
"""Change user's locale stored in the database.
|
"""Change user's locale stored in the database.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user