diff options
| author | Moritz Sichert <moritz.sichert@googlemail.com> | 2015-03-10 21:21:28 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-03-18 09:11:44 -0400 |
| commit | 571e093a258b00b25c24481af7acf0d0a034ec8c (patch) | |
| tree | cc7a23f375ac4429086a7f0b5dec6456dd1a84c3 /django/forms/forms.py | |
| parent | 1cd2584c980ca547ba34d7b0f9d2dc89569803fb (diff) | |
[1.8.x] Refs #24469 -- Fixed escaping of forms, fields, and media in non-Django templates.
Backport of 6bff3439894ac22d80f270f36513fc86586273f3 from master
Diffstat (limited to 'django/forms/forms.py')
| -rw-r--r-- | django/forms/forms.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/django/forms/forms.py b/django/forms/forms.py index 16fc5b00f2..869cc83283 100644 --- a/django/forms/forms.py +++ b/django/forms/forms.py @@ -138,6 +138,9 @@ class BaseForm(object): self.fields = copy.deepcopy(self.base_fields) self._bound_fields_cache = {} + def __html__(self): + return force_text(self) + def __str__(self): return self.as_table() @@ -534,6 +537,9 @@ class BoundField(object): self.help_text = field.help_text or '' self._initial_value = UNSET + def __html__(self): + return force_text(self) + def __str__(self): """Renders this field as an HTML widget.""" if self.field.show_hidden_initial: |
