Added Data table
This commit is contained in:
parent
b143e5749c
commit
0e4d93652b
|
@ -1,7 +1,14 @@
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
from django.utils.html import format_html
|
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
|
from idhub_auth.models import User
|
||||||
|
|
||||||
|
|
||||||
|
@ -199,3 +206,13 @@ class DIDTable(tables.Table):
|
||||||
model = DID
|
model = DID
|
||||||
template_name = "idhub/custom_table.html"
|
template_name = "idhub/custom_table.html"
|
||||||
fields = ("created_at", "label", "did", "edit_did", "delete_did")
|
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")
|
||||||
|
|
|
@ -37,7 +37,8 @@ from idhub.admin.tables import (
|
||||||
RolesTable,
|
RolesTable,
|
||||||
ServicesTable,
|
ServicesTable,
|
||||||
CredentialTable,
|
CredentialTable,
|
||||||
DIDTable
|
DIDTable,
|
||||||
|
DataTable
|
||||||
)
|
)
|
||||||
from idhub.models import (
|
from idhub.models import (
|
||||||
DID,
|
DID,
|
||||||
|
@ -867,10 +868,12 @@ class SchemasImportAddView(SchemasMix):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
class ImportView(ImportExport, TemplateView):
|
class ImportView(ImportExport, SingleTableView):
|
||||||
template_name = "idhub/admin/import.html"
|
template_name = "idhub/admin/import.html"
|
||||||
|
table_class = DataTable
|
||||||
subtitle = _('Import data')
|
subtitle = _('Import data')
|
||||||
icon = ''
|
icon = ''
|
||||||
|
model = File_datas
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{% extends "idhub/base_admin.html" %}
|
{% extends "idhub/base_admin.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
{% load render_table from django_tables2 %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h3>
|
<h3>
|
||||||
|
@ -8,6 +9,7 @@
|
||||||
</h3>
|
</h3>
|
||||||
<div class="row mt-5">
|
<div class="row mt-5">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
{% render_table table %}
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped table-sm">
|
<table class="table table-striped table-sm">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
Loading…
Reference in New Issue