We are using list-editable list to edit some fields of our model in开发者_运维技巧 the change list itself. However, we currently need to hook the save button of the change list to do some stuff on the changed models. Is there a hook for that?
Thanks,
Well, since it has been a while with no response I will give some clues. I had to figure this one out myself. If you look at the HTML generated by the admin for an editable list it provides the "Save" button with the name="_save"
. So in your admin if you override the changelist_view
method:
def changelist_view(self,request,extra_context):
if request.POST.has_key("_save"):
#Do something to if save was clicked.
pass
return admin.ModelAdmin.changelist_view(self,request,extra_context)
you can then add functionality to the save routine.
精彩评论