def test_as_crispy_errors_form_with_non_field_errors(self):
template = loader.get_template_from_string(u"""
{% load crispy_forms_tags %}
{{ form|as_crispy_errors }}
""")
form = TestForm({'password1': "god", 'password2': "wargame"})
form.is_valid()
c = Context({'form': form})
html = template.render(c)
self.assertTrue("errorMsg" in html or "alert" in html)
self.assertTrue("<li>Passwords dont match</li>" in html)
self.assertFalse("<h3>" in html)
评论列表
文章目录