magic_notifier.notifier
Module Contents
Functions
|
This function send a notification via the method specified in parameter vias |
Attributes
- magic_notifier.notifier.User
- magic_notifier.notifier.logger
- magic_notifier.notifier.notify(vias: list, subject: str = None, receivers: Union[str, list, django.db.models.QuerySet, django.db.models.Manager] = None, template: str = None, context: dict = None, final_message: str = None, email_gateway: str = 'default', sms_gateway: Optional[str] = None, files: list = None, threaded: bool = None)
This function send a notification via the method specified in parameter vias
- Parameters:
vias – accepted values are email,sms,push
subject – the subject of the notification, ignored when send by sms
receivers – it can be a list, queryset or manager of users. if a string is passed it must be admins to send to (super) admins, staff to send to staff only, all to all users, all-staff to all users minus staff and all-admins to all users excepted admins
template – the name of the template to user. Default None
context – the context to be passed to template. Note that the context is auto-filled with the current the notification is going under the key ‘user’. Default None
final_message – the final message to be sent as the notification content, must be sent if template is None, template is ignored if it is sent. Default None
email_gateway – the email gateway to use. Default ‘default’
sms_gateway – the sms gateway to use. Default to None
files – list of files to be sent. accept file-like objects, tuple, file path. Default None
threaded – if True, the notification is sent in background else sent with the current thread. Default to NOTIFIER[“THREADED”] settings
- Returns: