The Django administration system provides actions that we can execute for selected items in the list. There is one action given, by default, and it is used to delete selected instances. In this recipe, we will create an additional action for the list of the Product model, which will allow the administrators to export selected products to Excel spreadsheets.
Creating admin actions
Getting ready
We will start with the products app that we created in the previous recipe.
Make sure that you have the openpyxl module installed in your virtual environment, to create an Excel spreadsheet, as follows:
(myproject_env)$ pip3 install openpyxl~=2.5.0
If you are using a Docker project, add the dependency to your requirements and rebuild...