Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SingleTableView table_data attribute not same as get_query over write #891

Open
Timmy-Tenders opened this issue Feb 14, 2023 · 0 comments
Open

Comments

@Timmy-Tenders
Copy link

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,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant