1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #22383 -- Added support for HTML5 required attribute on required form fields.

This commit is contained in:
Jon Dufresne
2016-03-28 11:02:04 -07:00
committed by Tim Graham
parent 4d1c229ee5
commit ec6121693f
28 changed files with 849 additions and 659 deletions

View File

@@ -85,6 +85,8 @@ class BoundField(object):
widget.is_localized = True
attrs = attrs or {}
if not widget.is_hidden and self.field.required and self.form.use_required_attribute:
attrs['required'] = True
if self.field.disabled:
attrs['disabled'] = True
auto_id = self.auto_id