diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py
index 5830a79..07e90d1 100644
a
|
b
|
class SingleRelatedObjectDescriptor(object):
|
219 | 219 | if instance is None: |
220 | 220 | return self |
221 | 221 | try: |
222 | | return getattr(instance, self.cache_name) |
| 222 | rel_obj = getattr(instance, self.cache_name) |
| 223 | if rel_obj is None: |
| 224 | rmod = self.related.model |
| 225 | raise rmod.DoesNotExist( 'related %s does not exist' % rmod.__name__ ) |
| 226 | return rel_obj |
223 | 227 | except AttributeError: |
224 | 228 | params = {'%s__pk' % self.related.field.name: instance._get_pk_val()} |
225 | 229 | db = router.db_for_read(self.related.model, instance=instance) |
226 | 230 | |