django-tables2
django-tables2 copied to clipboard
Haystack Example
Hello, Similarly to the provided example with 'django_filters' package for filtering the data, would it be possible to include an example using Haystack since from the available pull requests it seems integration is feasible. Best regards,
You are welcome to contribute to the docs, I am not a haystack user myself, so I am not able to effectively create the example.
There is little information online specially using CBVs. I found someone that implemented it successfully I will get in touch soon, since I honestly think will be a great addition to see the integration of these two amazing packages.
@AndreGuerra123 Would you be able to provide a link to the example to which you're referring? I had a quick look around and was unable to find it.
I've got this working, but not sure if it's the right solution or a bit hacky...
from haystack.generic_views import SearchView
import django_tables2
from .tables import SearchTable
class MySearchView(django_tables2.SingleTableMixin, SearchView):
table_class = SearchTable
template_name = "search/mytemplate.html"
def get_table_data(self):
return [result.object for result in self.queryset]