简体   繁体   中英

Tastypie - Dehydrate not called on POST?

I need to access dehydrate to modify some data before it goes to validation (I can't modify the data in validation because I need access the the request object). However, my debugging statements indicate that POST requests aren't even reaching my dehydrate method (GET requests do reach it). Here is my dehydrate method, inside of a PostResource:

def dehydrate(self, bundle):
    print 'in dehydrate'
    bundle.data['location_model'] = self.get_via_uri(bundle.data['location'], bundle.request)
    return bundle

How can I call dehydrate in a post method?

在资源Meta设置always_return_data = True

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM