uploader-bot/app/core/models/user/display_mixin.py

17 lines
564 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') or ''} {self.meta.get('last_name') or ''}".strip()