1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #5749 -- Added field_name as a key in the _html_output dict

Thanks SmileyChris for the suggestion.
This commit is contained in:
e0ne
2013-09-10 16:09:55 +03:00
committed by Tim Graham
parent 4840fd9cbc
commit 053de6131a
2 changed files with 13 additions and 1 deletions

View File

@@ -1950,3 +1950,14 @@ class FormsTestCase(TestCase):
boundfield = SomeForm(label_suffix='!')['field']
self.assertHTMLEqual(boundfield.label_tag(label_suffix='$'), '<label for="id_field">Field$</label>')
def test_field_name(self):
"""#5749 - `field_name` may be used as a key in _html_output()."""
class SomeForm(Form):
some_field = CharField()
def as_p(self):
return self._html_output(u'<p id="p_%(field_name)s"></p>', u'%s', '</p>', u' %s', True)
form = SomeForm()
self.assertHTMLEqual(form.as_p(), '<p id="p_some_field"></p>')