You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm thinking a SingleTableMixin and MultipleTableMixin would be good. The following is a quick attempt at a SingleTableMixin, feedback would be appreciated. I think implementing the ability to change querystring variable names first (issue #5) would be a good idea, and necessary for MultipleTableMixin anyway.
class SingleTableMixin(object):
"""
Adds a suitable table to the context. Requires a ``table`` attribute on the
view.
"""
table = None
context_table_name = "table"
def get_context_data(self, **kwargs):
table = self.table(self.get_queryset(), order_by=self.request.GET.get('sort'))
table.paginate(page=self.request.GET.get('page', 1))
context = super(TableMixin, self).get_context_data(**kwargs)
context[self.context_table_name] = table
return context
The text was updated successfully, but these errors were encountered:
I'm thinking a
SingleTableMixin
andMultipleTableMixin
would be good. The following is a quick attempt at aSingleTableMixin
, feedback would be appreciated. I think implementing the ability to change querystring variable names first (issue #5) would be a good idea, and necessary forMultipleTableMixin
anyway.The text was updated successfully, but these errors were encountered: