def validate_non_whitespace_only_string(value):
    if not value or not value.strip():
        raise forms.ValidationError(u'This field is required', code='required')
Additionally to requiring a non-empty string, this validator also strips
dataset/ETHPy150Open django-de/djangosnippets.org/cab/cab/forms.py/validate_non_whitespace_only_string