#28171: empty_permitted=True contradicts use_required_attribute=True
------------------------------------------+------------------------
Reporter: Vlastimil Zíma | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------+------------------------
It is possible to easily create a form which does not provide expected
behavior. If a form is created with `empty_permitted=True`, it still
renders a required attribute into its inputs, although it clearly
shouldn't.
{{{
#!python
from django import forms
class FooForm(forms.Form):
foo = forms.CharField()
unicode(FooForm(empty_permitted=True))
>>> u'<tr><th><label for="id_foo">Foo:</label></th><td><input id="id_foo"
name="foo" type="text" required /></td></tr>'
}}}
I suggest to disable `use_required_attribute` if `empty_permitted` is
enabled and/or raise exception if both attributes are set up
contradictory. Even though `empty_permitted` is not a documented
attribute, incorrect usage should be limited if possible.
--
Ticket URL: <https://code.djangoproject.com/ticket/28171>
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/048.bfb505175cca16183e65f6ae7b1c14b4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.