问题描述
我将 wagtail 从 2.4 更新到最新版本 2.6.1,并注意到获取子页面以在 ADMIN UI 资源管理器中显示的 API 调用现在返回 0 个页面.
I updated wagtail to the latest version 2.6.1 from 2.4 and noticed that the API call that fetches child pages for displaying in the ADMIN UI explorer now returns 0 pages.
admin/api/v2beta/pages/?child_of=1&for_explorer=1
{meta:
{total_count: 0},
items: [],
__types: {}}
items: []
meta: {total_count: 0}
total_count: 0
__types: {}
还有吗?
推荐答案
如果您的项目为 Django REST Framework 的 DEFAULT_AUTHENTICATION_CLASSES
设置设置了自定义值,则似乎会发生这种情况.在这种情况下,Wagtail 的管理 API 最终将根据指定的身份验证方法返回结果,而不是当前登录的用户.
It appears that this can happen if your project has a custom value set for Django REST Framework's DEFAULT_AUTHENTICATION_CLASSES
setting. In this case, Wagtail's admin API will end up returning results based on the specified authentication method, rather than the current logged-in user.
https://github.com/wagtail/wagtail/issues/5585#issuecomment-543313909
要修复,请将 'rest_framework.authentication.SessionAuthentication'
添加到您的 DEFAULT_AUTHENTICATION_CLASSES
设置.未来几天可能会发布新版本 2.6.3 来解决这个问题.
To fix, add 'rest_framework.authentication.SessionAuthentication'
to your DEFAULT_AUTHENTICATION_CLASSES
setting. A new release 2.6.3 will likely be out in the next few days to address this.
这篇关于用于获取子页面的 Wagtail Admin api 调用在资源管理器中返回 0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!