πŸ” Overview

TelegramUserMapping links a Django User to a TelegramUser.

It is used by the notification system to find who should receive messages:

  • for a specific user
  • for the user’s masters (see Employee)

πŸ“‘ Fields

FieldTypeDescription
userOneToOne UserOne-to-one mapping from a Django user to Telegram identity (cascade on delete).
telegram_userForeign Key TelegramUserTelegram profile record (cascade on delete).

🧩 Methods

MethodDescription
get_telegram_user(user)Returns the TelegramUser for the given user (or None).
get_telegram_users_with_employee_master(user)Returns a set of Telegram user_external_id values for the user’s masters (and the user itself).

πŸ’‘ Meta

  • unique_together = ('user', 'telegram_user') prevents duplicates (even though user is one-to-one).