diff --git a/rest_framework/relations.py b/rest_framework/relations.py index 884b954c4..c7256587e 100644 --- a/rest_framework/relations.py +++ b/rest_framework/relations.py @@ -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__)