def generate_copo_datafiles_data(profile_id, data_file=None): d = DataFile(profile_id) # branch out, if a single record is provided if data_file: chunked_upload = ChunkedUpload.objects.get(id=int(data_file["file_id"])) row = [chunked_upload.filename, str(data_file["_id"])] return {"row_data": row, "table_id": "datafile_table"} datafiles = d.get_all_datafiles() # headers columns = [{"title": "File"}, {"title": " "}] dataSet = [] # data for df in datafiles: # get details of the file from the file object chunked_upload = ChunkedUpload.objects.get(id=int(df["file_id"])) row = [chunked_upload.filename, str(df["_id"])] dataSet.append(row) # define action buttons for the table. ALWAYS include the class 'copo-dt' in className!!! action_buttons = [ {'text': 'Describe', 'className': 'copo-dt btn btn-primary', 'iconClass': 'fa fa-tags'}, {'text': 'Delete', 'className': 'copo-dt btn btn-danger', 'iconClass': 'fa fa-trash-o'} ] return {"columns": columns, "dataSet": dataSet, "table_id": "datafile_table", "action_buttons": action_buttons}