I am using Django Admin.
I have a model with FileField and I need finish the following steps:
1-upload a excel file by Django Admin(It is easy)
2-read the header of the excel and display the fields of the header.
3-user choose some of the header and save their choice to the database.
How can I finish the job?
In this particular situation, I don’t think I’d be wanting to work through the Django Admin to try and do this. There’s enough going on that I’d probably want to create two separate views - the first view being a CreateView where the file can be uploaded, setting the
success_url to the second view.
The second view would then be able to process that just-uploaded file to extract the desired information and create your form for allowing the user to select which headers to save.
However, if you really want to tie this into the Admin function, you can Add Actions to the Model Admin. This includes adding actions that provide intermediate pages.
While you can do that, in this particular case I probably wouldn’t take that approach because it doesn’t seem to provide any real advantage to do so. The real question would be whether or not your functionality is intended to be used by a general user, or is reserved for an admin. Your description implies to me the former, which makes granting them access to the Admin site potentially problematic.