You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a request(GET/POST) is made to a model using the in-built API module, can one execute a post-processor? For instance, if I have a City model, and I make a POST request to add a new user, which then fires up a function to, say, get the city's co-ordinates from the Google Maps API?
The text was updated successfully, but these errors were encountered:
Might be a bit late now, but you could subclass RestResource and override create like so:
classPostSaveResource(RestResource):
defsave_object(self, instance, raw_data):
saved_instance=super(PostSaveResource, self).save_object(instance, raw_data)
#Do whatever you need to with the instance herereturnsaved_instance
Note that the same method is also called on saving existing instances, not just new ones. There are separate edit and create-methods, but you'd have to duplicate them partially to get hold of the instance and not just the response object.
When a request(GET/POST) is made to a model using the in-built API module, can one execute a post-processor? For instance, if I have a City model, and I make a POST request to add a new user, which then fires up a function to, say, get the city's co-ordinates from the Google Maps API?
The text was updated successfully, but these errors were encountered: