Add support for sortable columns

Add a new argument to the SourceColumn class to flag a column as
sortable. The SourceColum will generate a request querystring to
be used as the table header archor href. The SingleObjectListView
will capture the querystring and call the order_by on the queryset
to sort it.

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2018-12-23 05:11:14 -04:00
parent 36101dfea6
commit 25edc73100
17 changed files with 308 additions and 106 deletions
+1 -3
View File
@@ -84,6 +84,7 @@ class DocumentListView(SingleObjectListView):
def get_extra_context(self):
return {
'hide_links': True,
'hide_object': True,
'list_as_items': True,
'no_results_icon': icon_document_list,
'no_results_text': _(
@@ -963,9 +964,6 @@ class RecentAddedDocumentListView(DocumentListView):
context = super(RecentAddedDocumentListView, self).get_extra_context()
context.update(
{
'extra_columns': (
{'name': _('Added'), 'attribute': 'date_added'},
),
'no_results_icon': icon_document_list_recent_added,
'no_results_text': _(
'This view will list the latest documents uploaded '