Reputation: 35
I use the patch_list metodo in order to save and delete my resources. At the moment I need a way to call an external procedure on the entire list before the response is sent to the client.
Is there a better way than copy and paste the code of patch_list in my sources and modify it? Are there some hooks at list level?
Upvotes: 0
Views: 236
Reputation: 399
There is the hook - alter_list_data_to_serialize. Which is called just before creating the response.
def alter_list_data_to_serialize(self, request, data):
#call external procedure here
return data
data is the list to be serialized.
Upvotes: 1