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

Fixed #28171 -- Added an exception if Form's empty_permitted and use_required_attribute arguments conflict.

This commit is contained in:
Herbert Parentes Fortes Neto
2018-02-12 10:45:37 -02:00
committed by Tim Graham
parent e917ea6bec
commit d368784bac
2 changed files with 17 additions and 3 deletions

View File

@@ -99,6 +99,12 @@ class BaseForm:
if use_required_attribute is not None:
self.use_required_attribute = use_required_attribute
if self.empty_permitted and self.use_required_attribute:
raise ValueError(
'The empty_permitted and use_required_attribute arguments may '
'not both be True.'
)
# Initialize form renderer. Use a global default if not specified
# either as an argument or as self.default_renderer.
if renderer is None: