Let's say I have a model Message
. In admin, I need to add a message by submitting/uploading a message file, not by posting message fields as normally would. The process is, I get the file uploaded, send it to a processing program which parse the file, do some further processing and then add an entry into database.
So I create a custom form for ModelAdmin
(assign form = CustomForm)
with one FileField
and override save_model()
to not to save anything. However, this isn't a proper way as the doc clearly mention ModelAdmin's save_model() method is not for veto purpose. So what would be the proper way for this?
Some suggest an extra button pointed to a custom view, while it's surelly possible but logically I'm still adding a message so an extra view doesn't seem nature.