mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-24 00:04:16 +03:00
Merge pull request #860 from andymckay/master
startswith can take a tuple
This commit is contained in:
commit
e32a6e4211
|
@ -448,7 +448,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__)
|
||||
|
|
Loading…
Reference in New Issue
Block a user