Reputation: 26538
Normally django haystack search result is a list of 'result' object, in order to get to the actual object I need to use result.object
Which makes reusing the normal list template impossible, eg.
{% for item in object_list %}
{{ item.title }} # in search result {{ item.object.title }}
{% endfor %}
Is there a built-in method I can use to work around this problem or I need to write a custom search view to do this?
Upvotes: 1
Views: 585
Reputation: 141
I used {% with generic_item=item.object|default:item %}
then {{ generic_item.whatever }}
from then on
Upvotes: 2