1
0
mirror of https://github.com/django/django.git synced 2025-03-14 03:10:45 +00:00

[1.10.x] Fixed #26806 -- Triple quoted docstrings in docs/ref/forms/validation.txt.

Backport of 2032bcf18280a875a59a39cf85c226da0a310d11 from master
This commit is contained in:
Anderson Resende 2016-06-26 21:07:42 -03:00 committed by Tim Graham
parent 7f249e73dd
commit b752eae700

View File

@ -263,19 +263,16 @@ containing comma-separated email addresses. The full class looks like this::
class MultiEmailField(forms.Field):
def to_python(self, value):
"Normalize data to a list of strings."
"""Normalize data to a list of strings."""
# Return an empty list if no input was given.
if not value:
return []
return value.split(',')
def validate(self, value):
"Check if value consists only of valid emails."
"""Check if value consists only of valid emails."""
# Use the parent's handling of required fields, etc.
super(MultiEmailField, self).validate(value)
for email in value:
validate_email(email)