startswith can take a tuple

This commit is contained in:
Andy McKay 2013-05-18 07:09:24 -07:00
parent 80a2600891
commit aeba5bed05

View File

@ -442,7 +442,7 @@ class HyperlinkedRelatedField(RelatedField):
raise Exception('Writable related fields must include a `queryset` argument')
try:
http_prefix = value.startswith('http:') or value.startswith('https:')
http_prefix = value.startswith(('http:', 'https:'))
except AttributeError:
msg = self.error_messages['incorrect_type']
raise ValidationError(msg % type(value).__name__)