def schedule_cv_email(cv, email_address, email_text, from_address): email = EmailMessage('CV for %s' % cv.fullname(), email_text, from_address, [email_address], ['*****@*****.**']) pdf = render_to_pdf('pdf_template.html', {'model': cv}) email.attach( 'curriculum_vitae_for_%s_%s.pdf' % (cv.first_name, cv.surname), pdf, 'application/pdf') email.send(fail_silently=False)
def email_cv(self, email_address, article_text = None): email_text = '' if article_text: email_text = email_copy.APPLY_COPY % {'sender': self.fullname(), 'job_ad':article_text} else: email_text = email_copy.SEND_COPY % {'sender': self.fullname(), 'job_ad':article_text} email = EmailMessage('CV for %s' % self.fullname(), email_text, settings.SEND_FROM_EMAIL_ADDRESS, [email_address]) pdf = render_to_pdf('pdf_template.html', {'model': self}) email.attach('curriculum_vitae_for_%s_%s' % (self.first_name, self.surname), pdf, 'application/pdf') return email.send(fail_silently=False)
def test_convert_to_pdf(self): cv = self.user.get_profile() result = render_to_pdf('pdf_template.html', {'model': cv}) self.assertNotEquals(result, None)