#28874: Errors on hidden input fields print out double escaped HTML
-------------------------------------------+------------------------
Reporter: Kyle Agronick | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.11
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 1 |
-------------------------------------------+------------------------
Hidden input fields will print errors like "It\'s the thing &" as "(Hidden
field test) It's the thing &". with HTML that is double escaped as
{{{
<ul class="errorlist nonfield">
<li>(Hidden field test) It&#39;s the thing &amp;</li>
</ul>
}}}
Using this code:
views.py
{{{
class TestForm(forms.Form):
test = forms.CharField(widget=forms.HiddenInput(), required=False)
foo = forms.CharField()
class StoreGroupDelete(FormView):
form_class = TestForm
template_name = 'test/test_delete.html'
def form_valid(self, form):
form.add_error('test', 'It\'s the thing &')
return self.form_invalid(form)
}}}
test.html
{{{
<form method="post">
{% csrf_token %}
<ul>
{{ form.as_ul }}
</ul><input type="submit" />
</form>
}}}
This only happens on hidden inputs. Regular fields work fine. This is on
1.11.7.
--
Ticket URL: <https://code.djangoproject.com/ticket/28874>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.f0af1b546346a65c2c59f85f8b85d548%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.