Skip to content

Commit 74fc093

Browse files
committed
Fixed the error messages that occur when looking up attributes on a model. Thanks to acdha for the patch.
1 parent 207bf09 commit 74fc093

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

haystack/fields.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def prepare(self, obj):
6666

6767
for attr in attrs:
6868
if not hasattr(current_object, attr):
69-
raise SearchFieldError("The model '%s' does not have a model_attr '%s'." % (repr(current_object), attr))
69+
raise SearchFieldError("The model '%s' does not have a model_attr '%s'." % (repr(obj), attr))
7070

7171
current_object = getattr(current_object, attr, None)
7272

@@ -82,7 +82,7 @@ def prepare(self, obj):
8282
# accesses will fail misreably.
8383
break
8484
else:
85-
raise SearchFieldError("The model '%s' has an empty model_attr '%s' and doesn't allow a default or null value." % (repr(current_object), attr))
85+
raise SearchFieldError("The model '%s' has an empty model_attr '%s' and doesn't allow a default or null value." % (repr(obj), attr))
8686

8787
if callable(current_object):
8888
return current_object()

0 commit comments

Comments
 (0)