Paul85 Paul85 - 5 months ago 17
Python Question

Django datatables from dictionary

I am struggling to handle data tables in django project. My idea is to read a CSV file and store data in dictionary and then render it, which is working perfectly till now. But I want to make my display like in this image table

I have gone through this following example but seems like it is perfect for database which I am not doing now. So I don't have any models.py in my app but my views.py will display this following dictionary:

{'PEP2012090602': [['P09958', 'FURIN', 'Furin', 'MLDGEVTDAVEAR', 'Homo sapiens'], ['P23188', 'Furin', 'Furin', 'MLDGEVTDAVEAR', 'Mus musculus'], ['P23377', 'Furin', 'Furin', 'MLDGEVTDAVEAR', 'Rattus norvegicus'], ['P29119', 'furin', 'Furin-1', 'MLDGEVTDAVEAR', 'Xenopus laevis'], ['Q28193', 'FURIN', 'Furin', 'MLDGEVTDAVEAR', 'Bos taurus']]}


I am really new in django so I would appreciate if anyone kindly suggest me how to do or some tutorial where people already worked on this kind of example.

Answer Source

Thanks everyone for your suggestions. I have solved that problem just printing each element of my dictionary in template using following example