From 9bd225ce425e698883a5445a361cb672c923967a Mon Sep 17 00:00:00 2001 From: Arthur Gerbaud Date: Sun, 7 Aug 2016 12:13:15 +0200 Subject: [PATCH] fix Note --- notes/models.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/notes/models.py b/notes/models.py index 7245785..9063f44 100644 --- a/notes/models.py +++ b/notes/models.py @@ -74,9 +74,10 @@ class Note(models.Model): return for f in self._meta.get_fields(): if f.is_relation and f.one_to_one: - self._child_instance = getattr(self, f.name) - self._child_class = self._child_instance.__class__ - return + if hasattr(self, f.name): + self._child_instance = getattr(self, f.name) + self._child_class = self._child_instance.__class__ + return @property def child_class(self):