delete file datas

This commit is contained in:
Cayo Puigdefabregas 2024-03-12 18:37:01 +01:00
parent 489c91560e
commit 8a1871a7b3
2 changed files with 10 additions and 3 deletions

View File

@ -211,11 +211,18 @@ class DIDTable(tables.Table):
class DataTable(tables.Table): class DataTable(tables.Table):
created_at = tables.Column(verbose_name="Date") created_at = tables.Column(verbose_name="Date")
file_name = tables.Column(verbose_name="File") file_name = tables.Column(verbose_name="File")
delete_template_code = """<a class="text-danger"
href="{% url 'idhub:admin_import_del' record.id %}"
title="Remove"
><i class="bi bi-trash"></i></a>"""
delete_data = tables.TemplateColumn(template_code=delete_template_code,
orderable=False,
verbose_name="Delete")
class Meta: class Meta:
model = File_datas model = File_datas
template_name = "idhub/custom_table.html" template_name = "idhub/custom_table.html"
fields = ("created_at", "file_name", "success") fields = ("created_at", "file_name", "success", "delete_data")
class TemplateTable(tables.Table): class TemplateTable(tables.Table):

View File

@ -1080,8 +1080,8 @@ class ImportAddView(NotifyActivateUserByEmail, ImportExport, FormView):
return super().form_valid(form) return super().form_valid(form)
class ImportDeleteView(AdminView): class ImportDeleteView(AdminView, DeleteView):
model = PeopleView model = File_datas
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
self.check_valid_user() self.check_valid_user()