Ejemplo 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))
Ejemplo 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)
Ejemplo 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)
Ejemplo 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)