jieter/django-tables2

SingleTableView table_data attribute not same as get_query over write

Timmy-Tenders opened this issue · 0 comments

Hello,

First I wanted to thank you for your library it has helped me a lot. However, I have come across the following issue when using SingleTableView.

class ShowDatosTablas(SingleTableView):
    table_class = DatosTablasTable
    table_pagination = False
    template_name = "table.html"
    extra_context = {'viewExport': "testing"}

    def get_queryset(self):
        return DatosTablas.objects.all().values().using("test")

This code produces no errors. However, I wanted to use the following instead:

class ShowDatosTablas(SingleTableView):
    table_data=DatosTablas.objects.all().values().using("test")
    table_class = DatosTablasTable
    table_pagination = False
    template_name = "table.html"
    extra_context = {'viewExport': "testing"}

This is because some times my input wont be a queryset but wanted to test it with one but there was a error(I think both should work since in the documentation it says any compatible data source).

django.core.exceptions.ImproperlyConfigured: ShowDatosTablas is missing a QuerySet. Define ShowDatosTablas.model, ShowDatosTablas.queryset, or override ShowDatosTablas.get_queryset().

Thanks,