예제 #1
0
 def test_assign_none(self):
     m = DefaultTestModel()
     m.save()
     self.assertEqual(smart_text(m.text), "<p><strong>nice</strong></p>")
     m.text.raw = None
     m.save()
     self.assertEqual(smart_text(m.text), '')
     self.assertIsNone(m.text.raw)
     self.assertIsNone(m.text.rendered)
예제 #2
0
    def test_default_value_rendered(self):
        m = DefaultTestModel()
        m.save()

        self.assertEqual(
            m._meta.get_field('_text_rendered').default,
            m._meta.get_field('text').default)

        self.assertEqual(m._text_rendered, "<p><strong>nice</strong></p>")
예제 #3
0
 def test_assign_none(self):
     m = DefaultTestModel()
     m.save()
     self.assertEqual(smart_text(m.text), "<p><strong>nice</strong></p>")
     m.text.raw = None
     m.save()
     self.assertEqual(smart_text(m.text), '')
     self.assertIsNone(m.text.raw)
     self.assertIsNone(m.text.rendered)
예제 #4
0
    def test_default_value_rendered(self):
        m = DefaultTestModel()
        m.save()

        self.assertEqual(
            m._meta.get_field('_text_rendered').default,
            m._meta.get_field('text').default
        )

        self.assertEqual(m._text_rendered, "<p><strong>nice</strong></p>")
예제 #5
0
 def test_default_text_save(self):
     m = DefaultTestModel()
     m.save()
     self.assertEqual(smart_text(m.text), "<p><strong>nice</strong></p>")
예제 #6
0
 def test_default_text_save(self):
     m = DefaultTestModel()
     m.save()
     self.assertEqual(smart_text(m.text), "<p><strong>nice</strong></p>")