diff --git a/idhub/admin/tables.py b/idhub/admin/tables.py
index 51df7e8..6e6b273 100644
--- a/idhub/admin/tables.py
+++ b/idhub/admin/tables.py
@@ -211,11 +211,18 @@ class DIDTable(tables.Table):
class DataTable(tables.Table):
created_at = tables.Column(verbose_name="Date")
file_name = tables.Column(verbose_name="File")
+ delete_template_code = """"""
+ delete_data = tables.TemplateColumn(template_code=delete_template_code,
+ orderable=False,
+ verbose_name="Delete")
class Meta:
model = File_datas
template_name = "idhub/custom_table.html"
- fields = ("created_at", "file_name", "success")
+ fields = ("created_at", "file_name", "success", "delete_data")
class TemplateTable(tables.Table):
diff --git a/idhub/admin/views.py b/idhub/admin/views.py
index a030f99..e8e4876 100644
--- a/idhub/admin/views.py
+++ b/idhub/admin/views.py
@@ -1078,3 +1078,16 @@ class ImportAddView(NotifyActivateUserByEmail, ImportExport, FormView):
messages.error(self.request, e.message)
return super().form_valid(form)
+
+
+class ImportDeleteView(AdminView, DeleteView):
+ model = File_datas
+
+ def get(self, request, *args, **kwargs):
+ self.check_valid_user()
+ self.pk = kwargs['pk']
+ self.object = get_object_or_404(self.model, pk=self.pk)
+ self.object.delete()
+
+ return redirect('idhub:admin_import')
+
diff --git a/idhub/tests/test_credentials.py b/idhub/tests/test_credentials.py
index c5e6ead..ac95977 100644
--- a/idhub/tests/test_credentials.py
+++ b/idhub/tests/test_credentials.py
@@ -239,3 +239,13 @@ class CredentialsViewTest(TestCase):
def test_user_require_credential(self):
for p in PILOTS:
self._user_require_credentail(p)
+
+ def test_remove_file_data(self):
+ p = PILOTS[0]
+ self.admin_login()
+ self._upload_data_membership(p)
+ url = reverse('idhub:admin_import_del', args=[1])
+ response = self.client.get(url)
+ self.assertEqual(response.status_code, 302)
+ self.assertEqual(response.url, reverse('idhub:admin_import'))
+
diff --git a/idhub/urls.py b/idhub/urls.py
index d0230c9..cbcadcd 100644
--- a/idhub/urls.py
+++ b/idhub/urls.py
@@ -176,6 +176,8 @@ urlpatterns = [
name='admin_terms_and_conditions'),
path('admin/import/new', views_admin.ImportAddView.as_view(),
name='admin_import_add'),
+ path('admin/import//del', views_admin.ImportDeleteView.as_view(),
+ name='admin_import_del'),
path('admin/enc/', views_admin.EncryptionKeyView.as_view(), name='encryption_key'),
path('admin/auth/', views_admin.DobleFactorAuthView.as_view(),
name='admin_2fauth'),