Caught VariableDoesNotExist while rendering: Failed lookup for key [object] in u'None'

1,192 views
Skip to first unread message

fyoung

unread,
Apr 19, 2011, 12:24:21 PM4/19/11
to django-haystack
Hi,

I know the basics of Django but I'm new to Haystack and I'm having the
below problem with a site I took over recently. First of all, here is
some background on how haystack is integrated into my site:

I have an application named 'businesses' within a django project
called 'guide.' I have a search_indexes.py file within my 'businesses'
app which indexes information about all the businesses in the
'business' app. If I enter certain words into my search field, django
throws the following error:

TemplateSyntaxError at /businesses/search/
Caught VariableDoesNotExist while rendering: Failed lookup for key
[object] in u'None'

Request URL: http://www.kansanguide.com:8000/businesses/search/?q=the
Django Version: 1.3
Exception Type: TemplateSyntaxError
Exception Value:
Caught VariableDoesNotExist while rendering: Failed lookup for key
[object] in u'None'
Exception Location: /usr/local/lib/python2.6/dist-packages/django/
template/base.py in _resolve_lookup, line 692

Does anyone know why this error may be occurring or how I should go
about solving it? Please let me know if you need additional info about
the problem.

Thanks,

fyoung

Aaron VanDerlip

unread,
Apr 20, 2011, 9:13:55 AM4/20/11
to django-haystack
From the error, the template is attempting to access a variable from
named 'object' a non-existent object. Look in the template for this
page for clues as well as any template tags you might be including. It
may be the case that you are not getting a results set back from the
query.


Aaron

Daniel Lindsley

unread,
Apr 25, 2011, 11:16:29 PM4/25/11
to django-...@googlegroups.com
fyoung,


What may be the case is your template is trying to access ``{{
result.object }}`` on the search result of a deleted database record.
Haystack does not automatically handle deletions from the DB
propagating to the index. The quick fix is to run either ``./manage.py
update_index --remove`` (if you need the index to stay in place & can
spare the RAM) or ``./manage.py rebuild_index`` (which will wipe out
the whole index first & rebuild it over time).

A longer term solution is to either move to ``RealTimeSearchIndex``
or a queued solution.


Daniel

> --
> You received this message because you are subscribed to the Google Groups "django-haystack" group.
> To post to this group, send email to django-...@googlegroups.com.
> To unsubscribe from this group, send email to django-haysta...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-haystack?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages