在我的应用程序中,我想为item_lookup_field
我的一些资源端点使用该设置。我也需要版本控制。
在settings.py
我有以下内容:
[...]
VERSIONING = True
ITEM_URL = 'regex("[a-z0-9]{0,24}")'
DOMAIN = {
'people': {
'item_lookup_field': 'lastname',
'type': 'dict',
'schema': {
'firstname': { 'type': 'string' },
'lastname': { 'type': 'string', 'required': True, 'unique': True },
}
}
}
GET
端点上的 A有效/people/obama
,但/people/obama?version=1
会创建以下 KeyError:
Traceback (most recent call last):
File "/foobar/eve0.5_env/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
[...]
File "/foobar/eve0.5_env/lib/python2.7/site-packages/Eve-0.5_dev-py2.7.egg/eve/methods/get.py", line 210, in getitem
resource, req, lookup, document, version)
File "/foobar/eve0.5_env/lib/python2.7/site-packages/Eve-0.5_dev-py2.7.egg/eve/versioning.py", line 257, in get_old_document
lookup[versioned_id_field()] = lookup[app.config['ID_FIELD']]
KeyError: '_id'
我需要更改我的配置吗?
这是一个错误吗?
PS:第一次发帖,有需要的请告诉我