I have a very generic view/template to display the contents of a queryset of a given model.
I use from 12 places with 12 different querysets, now I wanted to integrate the haystack search in there but I can't because SearchQuerySet does not match a QuerySet in the template.
With the normal querysets I do
{%for obj in qs%}
{{obj.foreign_key.name }}
{%endfor%}
With the SearchQuerySet I would need to do
{%for obj in qs%}
{{obj.object.foreign_key.name}}
{%endfor%}
Which basically breaks my generic template and view that do now know where the queryset comes from.
I would like a way to have a searchqueryset behave like the normal queryset and I am aware that:
- I will lose the scores, although I will mantain the order
- I would need to do a load_all() to get the whole object in
Any hints on how can I keep my template generic but accept SearchQuerySet or convert SearchQuerySet to QuerySet ?