gpt4 book ai didi

python - 从管理页面隐藏 django-allauth 模型

转载 作者:行者123 更新时间:2023-12-05 03:46:13 26 4
gpt4 key购买 nike

我想从管理页面隐藏所有 django-allauth 模型

enter image description here

在我看到github中的源代码之后我看到它使用三种模型 SocialAccountSocialTokenSocialApp

现在我使用 this从管理页面隐藏模型,当我尝试在我自己的模型上使用它时它可以工作但是当我用它来隐藏 django-allauth 模型时它不起作用,我想我停留在 from x import SocialAccount, SocialToken, SocialApp

部分

因为错误信息总是这样

ImportError: cannot import name 'SocialAccount' from 'x'

我不知道x部分要导入什么,导入哪里

最佳答案

这有效。

from allauth.socialaccount.models import SocialAccount, SocialApp, SocialToken

admin.site.unregister(SocialAccount)
admin.site.unregister(SocialApp)
admin.site.unregister(SocialToken)

关于python - 从管理页面隐藏 django-allauth 模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65412702/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com