I hope they didn’t ask for it, and I just missed it, but I was looking for a bunch and could not find anything.
I am adding an extra save button for the django admin when adding or modifying an object. This is pretty easy to do. I simply overloaded submit_line.html to add an additional button, and then overrided the save_model function to check the name of that button. It works great.
My problem is that I need this button for only one object ... not all of them. I looked in the file change_form.html to find out how it knows which object it is dealing with, and found {{opts.module_name}}, but it doesn't seem to be available in submit_line.html. I tried to print it, and nothing appeared.
I also thought about hacking save_as (not very elegant, but I don't really care about this particular project), but this button only appears when changing .. not on adding, so this will not work.
Does anyone know how to determine which object I am working with in submit_line.html? Or any other way to do this?
Thank!
source
share