diff --git a/idhub/templates/idhub/user/dashboard.html b/idhub/templates/idhub/user/dashboard.html
index c13f776..22777ee 100644
--- a/idhub/templates/idhub/user/dashboard.html
+++ b/idhub/templates/idhub/user/dashboard.html
@@ -1,29 +1,12 @@
{% extends "idhub/base.html" %}
{% load i18n %}
+{% load render_table from django_tables2 %}
{% block content %}
{{ subtitle }}
-
-
-
-
- |
- |
- |
-
-
-
- {% for ev in user.events.all %}
-
- {{ ev.get_type_name }} |
- {{ ev.message }} |
- {{ ev.created }} |
-
- {% endfor %}
-
-
-
+{% render_table table %}
+
{% endblock %}
diff --git a/idhub/user/tables.py b/idhub/user/tables.py
new file mode 100644
index 0000000..0331bd6
--- /dev/null
+++ b/idhub/user/tables.py
@@ -0,0 +1,13 @@
+import django_tables2 as tables
+from idhub.models import Event
+
+
+class DashboardTable(tables.Table):
+ type = tables.Column(verbose_name="Event")
+ message = tables.Column(verbose_name="Description")
+ created = tables.Column(verbose_name="Date")
+
+ class Meta:
+ model = Event
+ template_name = "idhub/custom_table.html"
+ fields = ("type", "message", "created")
diff --git a/idhub/user/views.py b/idhub/user/views.py
index e6e28dc..042bc10 100644
--- a/idhub/user/views.py
+++ b/idhub/user/views.py
@@ -12,10 +12,14 @@ from django.shortcuts import get_object_or_404, redirect
from django.urls import reverse_lazy
from django.http import HttpResponse
from django.contrib import messages
+from django_tables2 import SingleTableView
+from idhub.user.tables import (
+ DashboardTable,
+)
from idhub.user.forms import (
- ProfileForm,
- RequestCredentialForm,
- DemandAuthorizationForm
+ ProfileForm,
+ RequestCredentialForm,
+ CredentialPresentationForm
)
from idhub.mixins import UserView
from idhub.models import DID, VerificableCredential, Event
@@ -31,13 +35,20 @@ class MyWallet(UserView):
section = "MyWallet"
-class DashboardView(UserView, TemplateView):
+class DashboardView(UserView, SingleTableView):
template_name = "idhub/user/dashboard.html"
+ table_class = DashboardTable
title = _('Dashboard')
subtitle = _('Events')
icon = 'bi bi-bell'
section = "Home"
+ def get_queryset(self, **kwargs):
+ queryset = Event.objects.select_related('user').filter(
+ user=self.request.user)
+
+ return queryset
+
class ProfileView(MyProfile, UpdateView):
template_name = "idhub/user/profile.html"