diff --git a/idhub/admin/tables.py b/idhub/admin/tables.py index a95ad63..6fa3c86 100644 --- a/idhub/admin/tables.py +++ b/idhub/admin/tables.py @@ -154,7 +154,8 @@ class DashboardTable(tables.Table): class CredentialTable(tables.Table): type = tables.Column(empty_values=()) - details = tables.Column(empty_values=()) + # Pending VerificableCredential description fix + details = tables.Column(empty_values=(), orderable=False) issued_on = tables.Column(verbose_name="Issued") view_credential = ButtonColumn( linkify={ @@ -173,6 +174,13 @@ class CredentialTable(tables.Table): def render_view_credential(self): return format_html('') + def order_type(self, queryset, is_descending): + queryset = queryset.order_by( + ("-" if is_descending else "") + "schema__type" + ) + + return (queryset, True) + class Meta: model = VerificableCredential template_name = "idhub/custom_table.html" diff --git a/idhub/admin/views.py b/idhub/admin/views.py index 255f5ab..d0b9405 100644 --- a/idhub/admin/views.py +++ b/idhub/admin/views.py @@ -554,7 +554,7 @@ class ServiceDeleteView(AccessControl): return redirect('idhub:admin_services') -class CredentialsView(Credentials): +class CredentialsView(Credentials, SingleTableView): template_name = "idhub/admin/credentials.html" table_class = CredentialTable subtitle = _('View credentials') @@ -562,11 +562,11 @@ class CredentialsView(Credentials): model = VerificableCredential def get_context_data(self, **kwargs): - context = super().get_context_data(**kwargs) - context.update({ - 'credentials': VerificableCredential.objects, - }) - return context + queryset = kwargs.pop('object_list', None) + if queryset is None: + self.object_list = self.model.objects.all() + + return super().get_context_data(**kwargs) class CredentialView(Credentials): diff --git a/idhub/templates/idhub/admin/credentials.html b/idhub/templates/idhub/admin/credentials.html index 43dc413..4862f82 100644 --- a/idhub/templates/idhub/admin/credentials.html +++ b/idhub/templates/idhub/admin/credentials.html @@ -7,34 +7,5 @@ {{ subtitle }} -
+{% render_table table %} {% endblock %}