From 4b77cbe70980f30906c043cd9d21ecf4a4c80bb6 Mon Sep 17 00:00:00 2001 From: abdulhaq Date: Sun, 15 Mar 2015 01:12:52 +0200 Subject: [PATCH] An empty value for the lookup_field corresponding to any instance will raise this error, the error message should indicate so to help debugging --- rest_framework/relations.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rest_framework/relations.py b/rest_framework/relations.py index 3a966c5bf..bcfd94041 100644 --- a/rest_framework/relations.py +++ b/rest_framework/relations.py @@ -267,7 +267,9 @@ class HyperlinkedRelatedField(RelatedField): 'Could not resolve URL for hyperlinked relationship using ' 'view name "%s". You may have failed to include the related ' 'model in your API, or incorrectly configured the ' - '`lookup_field` attribute on this field.' + '`lookup_field` attribute on this field, or perhaps your' + 'data contains an empty value for the `lookup_field` you' + 'specified.' ) raise ImproperlyConfigured(msg % self.view_name)