mirror of
https://github.com/django/django.git
synced 2025-10-30 17:16:10 +00:00
Fixed #24469 -- Refined escaping of Django's form elements in non-Django templates.
This commit is contained in:
committed by
Tim Graham
parent
dc5b01ad05
commit
1f2abf784a
@@ -10,6 +10,7 @@ from django.forms import (
|
||||
from django.forms.formsets import BaseFormSet, formset_factory
|
||||
from django.forms.utils import ErrorList
|
||||
from django.test import TestCase
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
|
||||
class Choice(Form):
|
||||
@@ -1093,6 +1094,11 @@ class FormsFormsetTestCase(TestCase):
|
||||
formset = ChoiceFormSet(data, auto_id=False, prefix='choices')
|
||||
self.assertEqual(formset.total_error_count(), 2)
|
||||
|
||||
def test_html_safe(self):
|
||||
formset = self.make_choiceformset()
|
||||
self.assertTrue(hasattr(formset, '__html__'))
|
||||
self.assertEqual(force_text(formset), formset.__html__())
|
||||
|
||||
|
||||
data = {
|
||||
'choices-TOTAL_FORMS': '1', # the number of forms rendered
|
||||
|
||||
Reference in New Issue
Block a user