Combining django-tables2 with django-filter info ListView?

531 views
Skip to first unread message

Paul

unread,
Aug 9, 2012, 4:47:56 PM8/9/12
to django...@googlegroups.com
I have a listview using the generic class based ListView. I have get_queryset overloaded in my view:

class WebsiteList(ListView):
    model = Website
    def get_queryset(self):
        return Website.objects.all()

First step is to add the tables2 mixin as follows:

class WebsiteList(tables.SingleTableMixin, ListView):
    model = Website
    table_class = WebsiteTable     #tables2 related
    def get_queryset(self):
        return Website.objects.all()

The mixin adds the table object to the context and adds an order_by clause to the queryset.

Now i don't know how to add a second mixin for django-filter; i have a mixin available but since it also fetches the queryset from get_queryset i'm expecting that either the ordering or the filtering won't work!?

Anyone with mixin experience willing to give some directions?

Paul

Sapana Kaswa-Surpuriya

unread,
Jan 20, 2014, 12:39:56 PM1/20/14
to django...@googlegroups.com
Were you able to implement it? Could you help me?
Reply all
Reply to author
Forward
0 new messages