I want to include a filefield in an admin model form that will be used to uploaded a file that will then be read and the contents will be used to update other fields in the same model. After processing the file itself is not needed, so i don’t want the filefield in the model just in the form.
I have no problem overriding save and processing the form myself, but I can’t figure out how to include a filefield in my form that is not in the model.
You should create a ModelForm for this model, and add the field there. It could look like this:
Then, you can make the ModelAdmin to use this form. If you saved MyModelForm in yourapp/forms.py, your ModelAdmin would look like this: