Search code examples
djangocsvdjango-admindjango-admin-actions

Django admin custom CSV report


I have a django project with 3 models. The user, the project (in which he works on) and the Change (which logs start and finish working time as well as the project and user).

I want to export a custom CSV report. Ex: total working hours of users per project, total hours devoted to a project etc. This means that there are some calculations to be done across models before exporting. So far I have found out how to export in CSV just filtered model entries, which isn't very helpful. I also found some tools online but most of them are outdated.

Can anyone point me to a direction or give me advice or links where I can learn more? Thank you.


Solution

  • Couple of ways to do this. You can use django-report-builder which is a pretty neat tool.

    Other ways are using custom views to admin site (check Django AdminPlus), overwrite queryset and use custom admin action etc.