One potential solution is to create a view that simply displays TastyPie's responses as HTML. This will allow django-debug-toolbar to output the correct profiling data. Below is a pretty quick and dirty try.
In urls.py:
Just add the following line to url templates, but make sure it is enabled only if debugging is enabled.
(r'^api_profile/(?P<resource>.*)$', 'common.views.api_profile')
In general /views.py:
Put this view anywhere, I put it in my regular application.
from django.shortcuts import render_to_response
from apps.api.urls import api
def api_profile(request, resource):
""" Allows easy profiling of API requests with django-debug-toolbar. """
context = {}
resource = resource.strip('/')
resource = api.canonical_resource_for(resource)
obj_list = resource.wrap_view('dispatch_list')(request)
response = resource.create_response(request, obj_list)
context['api_response'] = response
return render_to_response('common/api_profile.html', context)
In the / common / api _profile.html templates:
.
<body>
{{api_response}}
</body>
'/api_profile/a_resource/' django-debug a_resource. , . "api_profile/posts/? Limit = 8 & offset = 16".