# views.py
from django.shortcuts import render_to_response
from myapp.api.resources import UserResource
def user_detail(request, username):
ur = UserResource()
user = ur.obj_get(username=username)
# Other things get prepped to go into the context then...
ur_bundle = ur.build_bundle(obj=user, request=request)
return render_to_response('myapp/user_detail.html', {
# Other things here.
"user_json": ur.serialize(None, ur.full_dehydrate(ur_bundle), 'application/json'),
})
但它给出了错误,因为 obj_get() 需要 2 个参数。有人见过吗?我错了吗?