I'm looking for Django middleware to let me issue several queries in one request and combine the [JSON] results to send back in one request? To illustrate:
If I have two web methods:
/query/show/widgets
=> ['widget1', 'widget2']
/query/show/sprockets
=开发者_开发知识库> ['sprocket1', 'sprocket2']
and I want to do this:
/multiple:/show/widgets;/show/sprockets
which might return something like
{'widgets': ['widget1', 'widget2'],
'sprockets': ['sprocket1', 'sprocket2']}
I could write this myself but there may already be something that can do the job.
I highly doubt this exists, so you'll pretty much have to do it yourself.
Write a middleware that looks for your separator, split those URLs, resolve them and call the view, then merge the results.
精彩评论