From aeba5bed05e37344caf15adff180fc48404d992d Mon Sep 17 00:00:00 2001 From: Andy McKay Date: Sat, 18 May 2013 07:09:24 -0700 Subject: [PATCH] startswith can take a tuple --- rest_framework/relations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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__)