17 lines
560 B
Python
17 lines
560 B
Python
class DisplayMixin:
|
|
def json_format(self):
|
|
return {
|
|
"id": self.id,
|
|
"telegram_id": self.telegram_id,
|
|
"username": self.username,
|
|
"lang_code": self.lang_code,
|
|
"meta": self.meta,
|
|
"last_use": self.last_use.isoformat(),
|
|
"created": self.created.isoformat()
|
|
}
|
|
|
|
def front_format(self, plain_text=True):
|
|
if not plain_text:
|
|
raise NotImplementedError
|
|
|
|
return f"{self.meta.get('first_name', '')} {self.meta.get('last_name', '')}".strip() |