Ejemplo n.º 1
0
    def handle(self, *args, **options):
        client = Vivo()
        client._get_ticket_info()
        availables = client._save_tickets()

        if len(availables) > 0:
            emails = User.objects.filter(is_active=True).values_list('email', flat=True)
            mail = EmailTemplate(
                subject=u'Tem evento novo!', bcc=emails,
                tpl_message=u'scrapper/mail.txt',
                tpl_alternative=u'scrapper/mail.html',
                context={'tickets': availables}
            )

            mail.send()
Ejemplo n.º 2
0
    def handle(self, *args, **options):
        client = Vivo()
        client._get_ticket_info()
        availables = client._save_tickets()

        if len(availables) > 0:
            emails = User.objects.filter(is_active=True).values_list('email',
                                                                     flat=True)
            for email in emails:
                mail = EmailTemplate(to=[email],
                                     subject=u'Tem evento novo!',
                                     tpl_message=u'scrapper/mail.txt',
                                     tpl_alternative=u'scrapper/mail.html',
                                     context={'tickets': availables})

                mail.send()
Ejemplo n.º 3
0
    def form_valid(self, form):
        user = form.save()

        activation_url = '%s://%s%s?&activation_key=%s' % (
            self.request.scheme, self.request.get_host(),
            reverse('auth:activation'),
            user.confirmation_key
        )

        mail = EmailTemplate(
            subject=u'Ingressos Grátis - Ativação da conta', to=[user.email],
            tpl_message=u'registration/email/activation.txt',
            tpl_alternative=u'registration/email/activation.html',
            context={'activation_url': activation_url}
        )

        mail.send()

        return super(RegistrationView, self).form_valid(form)