def send_template(recipient, slug, context_data, related_objects=None, attachments=None, tag=None): """ Helper for building and sending e-mail message from a template. :param recipient: e-mail address of the receiver :param slug: slug of the e-mail template :param context_data: dict of data that will be sent to the template renderer :param related_objects: list of related objects that will be linked with the e-mail message with generic relation :param attachments: list of files that will be sent with the message as attachments :param tag: string mark that will be saved with the message :return: e-mail message object or None if template cannot be sent """ return _send_template( recipient=recipient, slug=slug, context_data=context_data, related_objects=related_objects, tag=tag, template_model=get_email_template_model(), attachments=attachments, )
def send_template(recipient, slug, context_data, related_objects=None, tag=None, send_immediately=None): """ Helper for building and sending push notification message from a template. :param recipient: push notification recipient :param slug: slug of a push notifiaction template :param context_data: dict of data that will be sent to the template renderer :param related_objects: list of related objects that will be linked with the push notification using generic relation :param tag: string mark that will be saved with the message :param send_immediately: publishes the message regardless of the `is_turned_on_batch_sending` result :return: Push notification message object or None if template cannot be sent """ return _send_template( recipient=recipient, slug=slug, context_data=context_data, related_objects=related_objects, tag=tag, template_model=get_push_notification_template_model(), send_immediately=send_immediately)
def send_template(recipient, slug, context_data, related_objects=None, tag=None): """ Helper for building and sending dialer message from a template. :param recipient: phone number of the recipient :param slug: slug of a dialer template :param context_data: dict of data that will be sent to the template renderer :param related_objects: list of related objects that will be linked with the dialer message using generic relation :param tag: string mark that will be saved with the message :return: dialer message object or None if template cannot be sent """ return _send_template( recipient, slug, context_data, related_objects, tag, template_model=get_dialer_template_model(), )