report_qs = CustomReport.objects.filter(id=report_id)
report_qs store below output
输出:
{
"Locator__employer_state": "AR",
"data_model_name": [
"Locator",
"PatientProfile"
]
}
问题:如何在 Python 中从上述输出中获取所有值和键?
当我尝试从上面的输出访问键和值时,我收到以下错误:
文件“/usr/local/lib/python2.6/dist-packages/django/core/servers/basehttp.py”,第 283 行,在运行 self.result = application(self.environ, self.start_response) 文件“/ usr/local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py”,第 272 行,调用中 response = self.get_response(request) File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 169, in get_response response = self.handle_uncaught_exception(request, resolver , sys.exc_info()) 文件 "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", 第 218 行, 在 handle_uncaught_exception 返回回调(request, **param_dict) 文件“/usr/local/lib/python2.6/dist-packages/django/utils/decorators.py”,第 93 行,在 _wrapped_view 响应 = view_func(request, *args, **kwargs) 文件“/usr/local/ lib/python2.6/dist-packages/django/views/defaults.py", line 30, in server_error t = loader.get_template(template_name) # 你需要创建一个 500.html 模板。文件“/usr/local/lib/python2.6/dist-packages/django/template/loader.py”,第 157 行,