コード例 #1
0
 def send_failed(self, request, queryset):
     emails = queryset.filter(sent=False)
     for email in emails:
         if getattr(settings, 'MAILQUEUE_CELERY', defaults.MAILQUEUE_CELERY):
             from mailqueue.tasks import send_mail
             send_mail.delay(email)
         else:
             email.send()
     self.message_user(request, "Emails queued.")
コード例 #2
0
    def send_mail(self):
        """ Public api to send mail.  Makes the determinination
         of using celery or not and then calls the appropriate methods.
        """

        if getattr(settings, 'MAILQUEUE_CELERY', defaults.MAILQUEUE_CELERY):
            from mailqueue.tasks import send_mail
            send_mail.delay(self.pk)
        else:
            self._send()
コード例 #3
0
ファイル: models.py プロジェクト: jose-espinoza-arce/rabbit
    def send_mail(self):
        """ Public api to send mail.  Makes the determinination
         of using celery or not and then calls the appropriate methods.
        """

        if getattr(settings, 'MAILQUEUE_CELERY', defaults.MAILQUEUE_CELERY):
            from mailqueue.tasks import send_mail
            send_mail.delay(self.pk)
        else:
            self._send()
コード例 #4
0
def send_post_save(sender, instance, signal, *args, **kwargs):
    if getattr(instance, "do_not_send", False):
        instance.do_not_send = False
        return

    if getattr(settings, 'MAILQUEUE_CELERY', defaults.MAILQUEUE_CELERY):
        from mailqueue.tasks import send_mail
        send_mail.delay(instance.pk)
    else:
        instance.send()
コード例 #5
0
def send_post_save(sender, instance, signal, *args, **kwargs):
    if getattr(instance, "do_not_send", False):
        instance.do_not_send = False
        return

    if getattr(settings, 'MAILQUEUE_CELERY', defaults.MAILQUEUE_CELERY):
        from mailqueue.tasks import send_mail
        send_mail.delay(instance.pk)
    else:
        instance.send()