Only enforce minimal length requirement if min_length is unset.

This commit is contained in:
Kevin Deldycke
2016-07-20 17:33:21 +02:00
parent 27a1ab3bf5
commit 0f981634bf

View File

@@ -328,7 +328,9 @@ class Text(Column):
Defaults to 1 if this is a ``required`` column. Otherwise, None.
:param int max_length: Sets the maximum length of this string, for validation purposes.
"""
self.min_length = min_length or (1 if kwargs.get('required', False) else None)
self.min_length = (
1 if not min_length and kwargs.get('required', False)
else min_length)
self.max_length = max_length
if self.min_length is not None: