Esempio n. 1
0
 def email_action(self, request, obj: Model):
     try:
         mailview_cls = MailView.for_model(type(obj))
         mailview = mailview_cls()
         html = mailview.get_html(obj)
         return HttpResponse(html)
     except RuntimeWarning as e:
         return HttpResponse(str(e))
Esempio n. 2
0
 def test_normal(self):
     don = Donation.objects.create(donator_name="Frank",
                                   donator_email="*****@*****.**")
     mv = PhysicalDonationMailView()
     self.assertTrue(mv.send(don))
     self.assertEqual(len(mail.outbox), 1)
     self.assertEqual(MailView.for_model(Donation),
                      PhysicalDonationMailView)
Esempio n. 3
0
 def email_action(self, request, obj: Model):
     mailview_cls = MailView.for_model(type(obj))
     mailview = mailview_cls()
     html = mailview.get_html(obj)
     return HttpResponse(html)
Esempio n. 4
0
 def test_normal(self):
     don = Donation.objects.create(donator_name="Frank", donator_email="*****@*****.**")
     mv = DonationMailView()
     self.assertTrue(mv.send(don))
     self.assertEqual(len(mail.outbox), 1)
     self.assertEqual(MailView.for_model(Donation), DonationMailView)