aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/relations.py
diff options
context:
space:
mode:
Diffstat (limited to 'rest_framework/relations.py')
-rw-r--r--rest_framework/relations.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/rest_framework/relations.py b/rest_framework/relations.py
index 4f971917..f9b5ff0d 100644
--- a/rest_framework/relations.py
+++ b/rest_framework/relations.py
@@ -127,7 +127,7 @@ class HyperlinkedRelatedField(RelatedField):
attributes are not configured to correctly match the URL conf.
"""
# Unsaved objects will not yet have a valid URL.
- if obj.pk:
+ if obj.pk is None:
return None
lookup_value = getattr(obj, self.lookup_field)