endi.models.notification package

Submodules

endi.models.notification.notification module

class endi.models.notification.notification.Notification(**kwargs)

Bases : Base

body

Contenu de la notification (peut inclure du code html)

channel

Canal d’envoi de la notification parmi un des trois canaux internes (message->cloche, header_message->haut depage, alert->modale)

due_date

Date d’apparition de la notification (notamment si on la repousse dans le temps)

event
event_id
id
key

Type de notification

postpone(request, deltadays: int = 7)

Move the notification’s due_date

read

Lu ?

status_type

Type de notification (valid/success/error/neutral…)

title

Titre de la notification

user
user_id
class endi.models.notification.notification.NotificationChannel(**kwargs)

Bases : Base

Notification channel names. Register all known Channels (allow third party libraries to register their own)

classmethod get_by_name(name)
id
label

Libellé (notamment pour l’admin)

name

Clé interne utilisée dans le code

class endi.models.notification.notification.NotificationEvent(**kwargs)

Bases : Base, TimeStampedMixin

Planned notification that will be dispatched to end users after due_date

Stores the notification information that will be used to issue the notifications

Also stores a check query to verify it’s still relevant

body

Contenu de la notification (peut contenir du html)

check_query

Requête de validité au format texte. L’event est annulé si la requête ne renvoie rien ou renvoie un résultat négatif (count(id) qui renverrai 0 par exemple)

company_id

Id de l’enseigne de destination

context_id

Id de l’objet auquel cette notification se réfère

context_tablename

Nom de la table de l’objet auquel cette notification se réfère (permet de modifier la notification en cas d’edit/delete de l’élément)

created_at
due_datetime

Date et heures d’échéance à partir de laquelle les notifications doivent être publiées

classmethod find_existing(context_tablename: str, context_id: int) Optional[NotificationEvent]

Find an existing NotificationEvent referring to the given context

follower_user_id

Id de l’entrepreneur (on enverra le message à son référent)

force_channel

Canal d’envoi de la notification (forcé à l’origine)

group_names

Liste des groups destinataires

id
is_read(request)

check if all related notifications have been read

is_valid(request)

Check if this notification should still be fired ?

key

Clé interne au logiciel (correspond à un type)

notifications

Liste des notifications associées à cet évènement (permet de les supprimer si l’event n’est plus d’actualité)

published

Les notifications ont-elles été publiées ?

title

Titre de la notification

updated_at
user_ids

Liste des ids des destinataires

class endi.models.notification.notification.NotificationEventType(**kwargs)

Bases : Base

Type of notification that are fired by the application

Third party libraries can add their own notifications type for which a channel can then be configured

default_channel_name

Channel à utiliser pour la publication (mail, message, alert, header_message)

classmethod get_status_type(key)
classmethod get_type(key)
id
key

Clé interne utilisée dans le code lors de l’envoi des notifications

label

Libellé

status_type

Type de notification (valid/success/error/neutral…)

Module contents