Added Data table

This commit is contained in:
Elijah 2023-12-06 11:45:04 +01:00 committed by Elahi
parent b143e5749c
commit 0e4d93652b
3 changed files with 25 additions and 3 deletions

View File

@ -1,7 +1,14 @@
import django_tables2 as tables
from django.utils.html import format_html
from idhub.models import Rol, Event, Service, VerificableCredential, DID
from idhub.models import (
Rol,
Event,
Service,
VerificableCredential,
DID,
File_datas
)
from idhub_auth.models import User
@ -199,3 +206,13 @@ class DIDTable(tables.Table):
model = DID
template_name = "idhub/custom_table.html"
fields = ("created_at", "label", "did", "edit_did", "delete_did")
class DataTable(tables.Table):
created_at = tables.Column(verbose_name="Date")
file_name = tables.Column(verbose_name="File")
class Meta:
model = File_datas
template_name = "idhub/custom_table.html"
fields = ("created_at", "file_name", "success")

View File

@ -37,7 +37,8 @@ from idhub.admin.tables import (
RolesTable,
ServicesTable,
CredentialTable,
DIDTable
DIDTable,
DataTable
)
from idhub.models import (
DID,
@ -867,10 +868,12 @@ class SchemasImportAddView(SchemasMix):
return data
class ImportView(ImportExport, TemplateView):
class ImportView(ImportExport, SingleTableView):
template_name = "idhub/admin/import.html"
table_class = DataTable
subtitle = _('Import data')
icon = ''
model = File_datas
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)

View File

@ -1,5 +1,6 @@
{% extends "idhub/base_admin.html" %}
{% load i18n %}
{% load render_table from django_tables2 %}
{% block content %}
<h3>
@ -8,6 +9,7 @@
</h3>
<div class="row mt-5">
<div class="col">
{% render_table table %}
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>